AstralAPI Docs
Resources

Channel

Channel

Channels are the containers bots read from, write to, and manage.

Depending on type, a channel may be:

  • a guild text channel
  • a guild voice channel
  • a DM
  • a group DM
  • a category or another specialized channel type

For message-specific endpoints, see Message.

Common public endpoints

EndpointPurpose
GET /channels/:channel_idFetch a single channel
PATCH /channels/:channel_idUpdate a channel
DELETE /channels/:channel_idDelete a channel or leave/remove yourself from a DM-style channel
GET /channels/:channel_id/rtc-regionsList available RTC regions for voice/call use
PUT /channels/:channel_id/recipients/:user_idAdd a recipient to a group DM
DELETE /channels/:channel_id/recipients/:user_idRemove a recipient from a group DM
PUT /channels/:channel_id/permissions/:overwrite_idCreate or replace a permission overwrite
DELETE /channels/:channel_id/permissions/:overwrite_idDelete a permission overwrite

Related routes:

  • GET /guilds/:guild_id/channels
  • POST /guilds/:guild_id/channels
  • PATCH /guilds/:guild_id/channels

Fetch a channel

curl -s \
  -H "Authorization: Bot $TOKEN" \
  https://astraof.com/api/v1/channels/<CHANNEL_ID>

Typical fields include:

{
  "id": "1470000000000000001",
  "type": 0,
  "name": "general",
  "guild_id": "1470000000000000002",
  "position": 0,
  "topic": "General discussion"
}

Update a channel

Only fields valid for the channel type may be updated.

curl -X PATCH \
  -H "Authorization: Bot $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name":"news","topic":"Official updates"}' \
  https://astraof.com/api/v1/channels/<CHANNEL_ID>

Permission overwrites

Use channel overwrites when your bot manages access for roles or users inside a guild.

curl -X PUT \
  -H "Authorization: Bot $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "type": 0,
    "allow": "1024",
    "deny": "2048"
  }' \
  https://astraof.com/api/v1/channels/<CHANNEL_ID>/permissions/<OVERWRITE_ID>

Notes:

  • type: 0 usually refers to a role overwrite
  • type: 1 usually refers to a user/member overwrite

Group DM recipients

For group DM style channels:

  • add a member with PUT /channels/:channel_id/recipients/:user_id
  • remove a member with DELETE /channels/:channel_id/recipients/:user_id

Voice and call-capable channels expose extra public routes:

  • GET /channels/:channel_id/rtc-regions
  • GET /channels/:channel_id/call
  • PATCH /channels/:channel_id/call

For that flow, see Voice.

On this page

Astral API Docs | Channel