curl -X POST "https://your-domain.com/api/channels/create" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"type": "standard",
"name": "announcements",
"description": "Official announcements",
"access_grants": [
{
"principal_type": "user",
"principal_id": "*",
"permission": "read"
},
{
"principal_type": "role",
"principal_id": "admin",
"permission": "write"
}
]
}'
{
"id": "ch_abc123",
"user_id": "user_123",
"type": "standard",
"name": "announcements",
"description": "Official announcements",
"is_private": false,
"data": null,
"meta": null,
"access_grants": [
{
"principal_type": "user",
"principal_id": "*",
"permission": "read"
},
{
"principal_type": "role",
"principal_id": "admin",
"permission": "write"
}
],
"created_at": 1709567890123456789,
"updated_at": 1709567890123456789,
"updated_by": null,
"archived_at": null,
"archived_by": null,
"deleted_at": null,
"deleted_by": null
}
Channels
Create Channel
Create a new channel
POST
/
api
/
channels
/
create
curl -X POST "https://your-domain.com/api/channels/create" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"type": "standard",
"name": "announcements",
"description": "Official announcements",
"access_grants": [
{
"principal_type": "user",
"principal_id": "*",
"permission": "read"
},
{
"principal_type": "role",
"principal_id": "admin",
"permission": "write"
}
]
}'
{
"id": "ch_abc123",
"user_id": "user_123",
"type": "standard",
"name": "announcements",
"description": "Official announcements",
"is_private": false,
"data": null,
"meta": null,
"access_grants": [
{
"principal_type": "user",
"principal_id": "*",
"permission": "read"
},
{
"principal_type": "role",
"principal_id": "admin",
"permission": "write"
}
],
"created_at": 1709567890123456789,
"updated_at": 1709567890123456789,
"updated_by": null,
"archived_at": null,
"archived_by": null,
"deleted_at": null,
"deleted_by": null
}
Creates a new channel. The type of channel determines who can create it and how it behaves:
dm- Direct message channel between usersgroup- Private group channel with invited membersstandard- Public or restricted channel (admin only)
Authentication
Requires a valid user session. Admin role required for creatingstandard channels.
Request Body
Channel type:
dm, group, or standard. Only admins can create standard channels.Channel name (can be empty for DM channels)
Channel description
Whether the channel is private (for group channels)
Array of user IDs to invite to the channel
Array of group IDs to grant access to the channel
Additional channel data
Channel metadata
Response
Returns the created channel object.Unique channel identifier
ID of the user who created the channel
Channel type
Channel name
Channel description
Whether the channel is private
Access control grants
Creation timestamp (epoch time in nanoseconds)
Last update timestamp (epoch time in nanoseconds)
curl -X POST "https://your-domain.com/api/channels/create" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"type": "standard",
"name": "announcements",
"description": "Official announcements",
"access_grants": [
{
"principal_type": "user",
"principal_id": "*",
"permission": "read"
},
{
"principal_type": "role",
"principal_id": "admin",
"permission": "write"
}
]
}'
{
"id": "ch_abc123",
"user_id": "user_123",
"type": "standard",
"name": "announcements",
"description": "Official announcements",
"is_private": false,
"data": null,
"meta": null,
"access_grants": [
{
"principal_type": "user",
"principal_id": "*",
"permission": "read"
},
{
"principal_type": "role",
"principal_id": "admin",
"permission": "write"
}
],
"created_at": 1709567890123456789,
"updated_at": 1709567890123456789,
"updated_by": null,
"archived_at": null,
"archived_by": null,
"deleted_at": null,
"deleted_by": null
}
Notes
- For DM channels, if a channel already exists between the specified users, the existing channel is returned instead of creating a duplicate
- The creator is automatically added as a member of the channel with manager role
- Only admins can create
standardtype channels - Members are automatically added to the channel’s socket room for real-time updates
⌘I