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"
}
]
}'
curl -X POST "https://your-domain.com/api/channels/create" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"type": "dm",
"name": "",
"user_ids": ["user_456"]
}'
curl -X POST "https://your-domain.com/api/channels/create" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"type": "group",
"name": "Project Team",
"description": "Private team discussion",
"is_private": true,
"user_ids": ["user_456", "user_789"],
"group_ids": ["group_123"]
}'
import requests
response = requests.post(
"https://your-domain.com/api/channels/create",
headers={"Authorization": "Bearer YOUR_TOKEN"},
json={
"type": "group",
"name": "Engineering",
"description": "Engineering team discussions",
"is_private": True,
"user_ids": ["user_456", "user_789"]
}
)
channel = response.json()
print(f"Created channel: {channel['id']}")
{
"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
}
{
"detail": "Unauthorized"
}
{
"detail": "ERROR"
}
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"
}
]
}'
curl -X POST "https://your-domain.com/api/channels/create" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"type": "dm",
"name": "",
"user_ids": ["user_456"]
}'
curl -X POST "https://your-domain.com/api/channels/create" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"type": "group",
"name": "Project Team",
"description": "Private team discussion",
"is_private": true,
"user_ids": ["user_456", "user_789"],
"group_ids": ["group_123"]
}'
import requests
response = requests.post(
"https://your-domain.com/api/channels/create",
headers={"Authorization": "Bearer YOUR_TOKEN"},
json={
"type": "group",
"name": "Engineering",
"description": "Engineering team discussions",
"is_private": True,
"user_ids": ["user_456", "user_789"]
}
)
channel = response.json()
print(f"Created channel: {channel['id']}")
{
"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
}
{
"detail": "Unauthorized"
}
{
"detail": "ERROR"
}
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
string
Channel type:
dm, group, or standard. Only admins can create standard channels.string
required
Channel name (can be empty for DM channels)
string
Channel description
boolean
Whether the channel is private (for group channels)
array
Array of user IDs to invite to the channel
array
Array of group IDs to grant access to the channel
array
object
Additional channel data
object
Channel metadata
Response
Returns the created channel object.string
required
Unique channel identifier
string
required
ID of the user who created the channel
string
Channel type
string
required
Channel name
string
Channel description
boolean
Whether the channel is private
array
Access control grants
integer
required
Creation timestamp (epoch time in nanoseconds)
integer
required
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"
}
]
}'
curl -X POST "https://your-domain.com/api/channels/create" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"type": "dm",
"name": "",
"user_ids": ["user_456"]
}'
curl -X POST "https://your-domain.com/api/channels/create" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"type": "group",
"name": "Project Team",
"description": "Private team discussion",
"is_private": true,
"user_ids": ["user_456", "user_789"],
"group_ids": ["group_123"]
}'
import requests
response = requests.post(
"https://your-domain.com/api/channels/create",
headers={"Authorization": "Bearer YOUR_TOKEN"},
json={
"type": "group",
"name": "Engineering",
"description": "Engineering team discussions",
"is_private": True,
"user_ids": ["user_456", "user_789"]
}
)
channel = response.json()
print(f"Created channel: {channel['id']}")
{
"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
}
{
"detail": "Unauthorized"
}
{
"detail": "ERROR"
}
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