Guild channels¶
A guild is divided into channels, and categories group them. The routes on this page list a guild's channels, create channels and categories, and change their order and parent. Channels defines the channel object and every per-channel operation, including modifying and deleting a channel or category, and setting permission overwrites.
All routes are relative to https://tebhos.com/api/v1, require authentication and accept both user sessions and bot tokens, except where a route is marked user-only (a valid bot token is then refused with 403 ACCESS_DENIED). A caller who is not a member of the guild receives 403 FORBIDDEN. Error bodies follow Errors.
Guild channel types¶
These are the channel types that exist inside a guild, and the values Create guild channel accepts in type.
| Value | Name | Description |
|---|---|---|
| 0 | GUILD_TEXT | Text channel with messages and slowmode |
| 2 | GUILD_VOICE | Voice channel with voice sessions, screen sharing and a text chat |
| 4 | GUILD_CATEGORY | Category that groups other channels |
| 998 | GUILD_LINK | Channel whose only content is an external http/https URL |
A category is a channel row of type 4. It has a name, a position and permission overwrites, and other channels point to it with parent_id. Categories cannot be nested.
Create permission overwrite object¶
The initial overwrites a channel can be created with. The stored form is the permission overwrite object.
| Field | Type | Description |
|---|---|---|
| id | snowflake | The role ID (type 0) or user ID (type 1) the overwrite targets. The @everyone role has the guild's ID |
| type | integer | 0 for a role, 1 for a member. Any other value returns 400 BAD_REQUEST |
| allow? | string or integer | Permission bits to grant, as a decimal string or a non-negative JSON integer (default 0) |
| deny? | string or integer | Permission bits to remove (default 0) |
The same bit in both allow and deny returns 400 BAD_REQUEST. Bits that name no defined permission are dropped.
Channel position object¶
One entry of Modify guild channel positions.
| Field | Type | Description |
|---|---|---|
| id | snowflake | The channel or category to move |
| position? | integer | Index among the destination siblings, clamped to the valid range. Ignored when preceding_sibling_id is present |
| parent_id? | ?snowflake | New parent category, or null to move the channel to the top level. Omit it to keep the current parent |
| preceding_sibling_id? | ?snowflake | The sibling the channel is placed directly after, or null to place it first |
| lock_permissions? | boolean | When the entry moves the channel into a different category, replace the channel's overwrites with the category's (default false) |
Siblings are counted per bucket: categories are ordered among the other categories, and every other channel is ordered among the channels with the same parent (or among the top-level channels). When an entry has neither position nor preceding_sibling_id, a voice channel is placed last and any other channel directly before the first voice sibling.
{
"id": "1501314428688998182",
"parent_id": "1501314428688998100",
"preceding_sibling_id": null,
"lock_permissions": true
}
List guild channels¶
GET /guilds/{guild_id}/channels
Returns an array of channel objects for the guild, ordered by position and then by ID. A channel or category is included only when the caller holds VIEW_CHANNEL in it. Requires membership. The route has no pagination.
Rate limit: guild:channels:list, 60 per 10 seconds per account and guild.
curl https://tebhos.com/api/v1/guilds/1489002177550843904/channels \
-H "Authorization: Bot $TEBHOS_BOT_TOKEN"
Other ways to get channels
The Ready payload and the channels array of Get guild also carry the guild's channels. The array on Get guild is not filtered by visibility.
Create guild channel¶
POST /guilds/{guild_id}/channels
Creates a channel or category and returns its channel object with status 201. Requires MANAGE_CHANNELS. The guild receives Channel Create.
Creating a category (type 4) is user-only. Creating any other type also accepts a bot token.
Rate limit: guild:channel:create, 10 per 60 seconds per account and guild (text, voice and link channels; category creation has no route bucket).
JSON body¶
| Field | Type | Description |
|---|---|---|
| name | string | The channel name, 1-100 characters. Stored as given |
| type? | integer | A guild channel type (default 0). Any other value returns 400 BAD_REQUEST |
| parent_id? | ?snowflake | The parent category. Must be a category in this guild; a category cannot have a parent |
| topic? | ?string | The channel topic |
| url? | ?string | The destination of a link channel: an http or https URL of at most 2048 characters, with a host and no user information. Sending url for any other type returns 400 BAD_REQUEST |
| rate_limit_per_user? | ?integer | Slowmode interval in seconds (default 0) |
| bitrate? | ?integer | Voice bitrate in bits per second. A value below 1000 is read as kbps and multiplied by 1000. Used only for a voice channel. See the limits below |
| user_limit? | ?integer | Voice occupancy limit, clamped to 0-99 (default 0, no limit) |
| voice_connection_limit? | ?integer | Simultaneous voice connections one member may hold in the channel, clamped to 1-100. When omitted the stored value is null and clients use 5 |
| permission_overwrites? | array[create permission overwrite object] | The complete initial overwrites |
| nsfw? | boolean | Accepted for compatibility and ignored; TEBHOS has no age-restricted channels |
For a category, only name and permission_overwrites are used.
Permission overwrites. When permission_overwrites is omitted, a channel created inside a category copies that category's overwrites. When it is present (an empty array included), it replaces that inheritance completely. Supplying it requires MANAGE_ROLES as well, and every bit an overwrite allows must be a bit the caller holds in the parent category (or in the guild when there is no parent); otherwise the request fails with 403 FORBIDDEN before anything is created. See Role hierarchy.
Bitrate. A new voice channel defaults to 64000 (64 kbps). The lowest accepted value is 8000 (8 kbps). The highest bitrate a caller can set is the larger of their own allowance and the guild's boost allowance:
| Source | Ceiling |
|---|---|
| No Pro, boost level 0 | 96 kbps |
| Caller has TEBHOS Pro | 128 kbps |
| Guild at boost level 1 | 128 kbps |
| Guild at boost level 2 | 384 kbps |
A higher value returns 403 BITRATE_REQUIRES_UPGRADE, or 400 BITRATE_EXCEEDS_LIMIT when the ceiling is already 384 kbps.
Position. A new channel is placed after the highest position among the channels with the same parent. A new category is placed after the last category.
| Status | Code | Condition |
|---|---|---|
| 400 | INVALID_FORM_BODY |
name is empty or longer than 100 characters, url is invalid, or the bitrate is below 8 kbps |
| 400 | BAD_REQUEST |
Unsupported type, invalid parent_id, a parent for a category, url on a non-link channel, or an invalid overwrite |
| 400 | BITRATE_EXCEEDS_LIMIT |
The bitrate is above 384 kbps |
| 403 | FORBIDDEN |
MANAGE_CHANNELS is missing, overwrites were supplied without MANAGE_ROLES or grant a bit the caller lacks |
| 403 | BITRATE_REQUIRES_UPGRADE |
The bitrate exceeds the caller's ceiling |
| 403 | ACCESS_DENIED |
A bot tried to create a category |
Creating a text, voice or link channel records a CHANNEL_CREATE audit log entry.
curl -X POST https://tebhos.com/api/v1/guilds/1489002177550843904/channels \
-H "Authorization: Bot $TEBHOS_BOT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "announcements",
"type": 0,
"parent_id": "1501314428688998100",
"permission_overwrites": [
{"id": "1489002177550843904", "type": 0, "deny": "2048"}
]
}'
Modify guild channel positions¶
PATCH /guilds/{guild_id}/channels
Moves and reorders channels and categories, and returns 204 with no body. The body is a JSON array of channel position objects. Requires MANAGE_CHANNELS.
Rate limit: guild:channel:positions, 30 per 10 seconds per account and guild.
Entries are applied in array order, each to the result of the previous one. The whole request is validated before anything is written, so an invalid entry leaves every channel unchanged:
| Status | Code | Condition |
|---|---|---|
| 400 | BAD_REQUEST |
An ID is not a snowflake, parent_id is not a category in this guild, a category was given a parent, or preceding_sibling_id is not in the destination bucket |
| 403 | FORBIDDEN |
MANAGE_CHANNELS is missing, or lock_permissions would copy overwrites the caller cannot grant |
| 404 | NOT_FOUND |
An entry's id is not a channel in this guild |
Within each affected bucket, positions are renumbered from 0 in the resulting order. Moving a category changes only its place among the categories; its channels keep their parent. Only rows whose position, parent or overwrites actually change are written.
lock_permissions takes effect only when the entry moves the channel into a different category. It copies the category's overwrites onto the channel and requires MANAGE_ROLES in the moved channel; every bit the copy allows, and every bit it stops denying, must be one the caller holds there.
When at least one channel changed, the guild receives one Channel Update Bulk event carrying the guild's channels as stored after the change. The operation records no audit log entry.
curl -X PATCH https://tebhos.com/api/v1/guilds/1489002177550843904/channels \
-H "Authorization: Bot $TEBHOS_BOT_TOKEN" \
-H "Content-Type: application/json" \
-d '[{"id": "1501314428688998182", "parent_id": "1501314428688998100", "preceding_sibling_id": null}]'
Categories¶
A category is created with Create guild channel and type 4, and moved with Modify guild channel positions. Renaming a category, changing its overwrites and deleting it use the channel routes: Modify channel, Set channel permission overwrite and Delete channel. Sync channel permissions with category copies a category's overwrites onto one of its channels.