Discord Gateway API

The Discord Gateway API provides persistent, stateful WebSocket connections between your client and Discord servers. These connections are used for sending and receiving real-time events your client can use to track and update local state, including message creation, guild updates, presence changes, and voice state updates.

GitHub OpenAPI

Operations 2

Each operation below carries the questions people ask an LLM about it and the instructions they give an agent to run it. Generated by API Evangelist overlay

1 of 2 operations are conformant: apis.io called them with no credentials and the responses matched this contract. Checked 2026-11-12. how this works · status file

GET /gateway Get the gateway URL for the Discord API · Get gateway conformant #
Ask an LLM
“What is the gateway URL for the Discord API?”
“Can I get the gateway endpoint for my bot?”
Tell an agent
Get the Discord API gateway URL.
Fetch the gateway endpoint for the API.
GET /gateway/bot Get the bot gateway URL · Get bot gateway #
Ask an LLM
“What gateway URL should my bot connect to?”
“Can I fetch the bot gateway endpoint?”
Tell an agent
Get the bot gateway URL.
Fetch the gateway endpoint my bot should use.

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/discord:discord-gateway-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

discord-gateway-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Discord HTTP API (Preview) Gateway API
  description: Preview of the Discord v10 HTTP API specification. See https://discord.com/developers/docs for more details.
  termsOfService: https://discord.com/developers/docs/policies-and-agreements/developer-terms-of-service
  license:
    name: MIT
    identifier: MIT
  version: '10'
servers:
- url: https://discord.com/api/v10
tags:
- name: Gateway
paths:
  /gateway:
    get:
      operationId: get_gateway
      responses:
        '200':
          description: 200 response for get_gateway
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/X-RateLimit-Limit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/X-RateLimit-Remaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/X-RateLimit-Reset'
            X-RateLimit-Reset-After:
              $ref: '#/components/headers/X-RateLimit-Reset-After'
            X-RateLimit-Bucket:
              $ref: '#/components/headers/X-RateLimit-Bucket'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayResponse'
        '429':
          $ref: '#/components/responses/ClientRatelimitedResponse'
        4XX:
          $ref: '#/components/responses/ClientErrorResponse'
      security:
      - {}
      - BotToken: []
      tags:
      - Gateway
      summary: Get gateway
      x-summary-source: derived
  /gateway/bot:
    get:
      operationId: get_bot_gateway
      responses:
        '200':
          description: 200 response for get_bot_gateway
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/X-RateLimit-Limit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/X-RateLimit-Remaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/X-RateLimit-Reset'
            X-RateLimit-Reset-After:
              $ref: '#/components/headers/X-RateLimit-Reset-After'
            X-RateLimit-Bucket:
              $ref: '#/components/headers/X-RateLimit-Bucket'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayBotResponse'
        '429':
          $ref: '#/components/responses/ClientRatelimitedResponse'
        4XX:
          $ref: '#/components/responses/ClientErrorResponse'
      security:
      - BotToken: []
      tags:
      - Gateway
      summary: Get bot gateway
      x-summary-source: derived
components:
  headers:
    X-RateLimit-Reset-After:
      schema:
        type: number
      description: The duration in seconds until the current ratelimit window resets
    X-RateLimit-Limit:
      schema:
        type: integer
      description: The maximum number of requests that can be made in the current ratelimit window
    X-RateLimit-Remaining:
      schema:
        type: integer
      description: The number of requests remaining in the current ratelimit window
    X-RateLimit-Bucket:
      schema:
        type: string
      description: The bucket that the request belongs to
    X-RateLimit-Reset:
      schema:
        type: number
      description: A unix timestamp in seconds at which the current ratelimit window resets
  schemas:
    InnerErrors:
      type: object
      properties:
        _errors:
          type: array
          description: The list of errors for this field
          items:
            $ref: '#/components/schemas/Error'
      additionalProperties: false
      required:
      - _errors
    GatewayBotSessionStartLimitResponse:
      type: object
      properties:
        max_concurrency:
          type: integer
          format: int32
        remaining:
          type: integer
          format: int32
        reset_after:
          type: integer
          format: int32
        total:
          type: integer
          format: int32
      required:
      - max_concurrency
      - remaining
      - reset_after
      - total
    ErrorResponse:
      type: object
      description: Errors object returned by the Discord API
      allOf:
      - $ref: '#/components/schemas/Error'
      - type: object
        properties:
          errors:
            $ref: '#/components/schemas/ErrorDetails'
    ErrorDetails:
      oneOf:
      - type: object
        additionalProperties:
          $ref: '#/components/schemas/ErrorDetails'
      - $ref: '#/components/schemas/InnerErrors'
    RatelimitedResponse:
      type: object
      description: Ratelimit error object returned by the Discord API
      allOf:
      - $ref: '#/components/schemas/Error'
      - type: object
        properties:
          retry_after:
            type: number
            description: The number of seconds to wait before retrying your request
          global:
            type: boolean
            description: Whether you are being ratelimited by the global ratelimit or a per-endpoint ratelimit
        required:
        - retry_after
        - global
    GatewayResponse:
      type: object
      properties:
        url:
          type: string
          format: uri
      required:
      - url
    GatewayBotResponse:
      type: object
      properties:
        url:
          type: string
          format: uri
        session_start_limit:
          $ref: '#/components/schemas/GatewayBotSessionStartLimitResponse'
        shards:
          type: integer
          format: int32
      required:
      - url
      - session_start_limit
      - shards
    Error:
      type: object
      description: A single error, either for an API response or a specific field.
      properties:
        code:
          type: integer
          description: Discord internal error code. See error code reference
        message:
          type: string
          description: Human-readable error message
      required:
      - code
      - message
  responses:
    ClientRatelimitedResponse:
      description: Client ratelimited response
      headers:
        X-RateLimit-Limit:
          $ref: '#/components/headers/X-RateLimit-Limit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/X-RateLimit-Remaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/X-RateLimit-Reset'
        X-RateLimit-Reset-After:
          $ref: '#/components/headers/X-RateLimit-Reset-After'
        X-RateLimit-Bucket:
          $ref: '#/components/headers/X-RateLimit-Bucket'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/RatelimitedResponse'
    ClientErrorResponse:
      description: Client error response
      headers:
        X-RateLimit-Limit:
          $ref: '#/components/headers/X-RateLimit-Limit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/X-RateLimit-Remaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/X-RateLimit-Reset'
        X-RateLimit-Reset-After:
          $ref: '#/components/headers/X-RateLimit-Reset-After'
        X-RateLimit-Bucket:
          $ref: '#/components/headers/X-RateLimit-Bucket'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    BotToken:
      type: apiKey
      description: Discord bot token
      name: Authorization
      in: header
    OAuth2:
      type: oauth2
      flows:
        implicit:
          authorizationUrl: https://discord.com/api/oauth2/authorize
          refreshUrl: https://discord.com/api/oauth2/token
          scopes:
            activities.invites.write: allows your app to send activity invites - requires Discord approval (NOT REQUIRED FOR GAMESDK ACTIVITY MANAGER)
            activities.read: allows your app to fetch data from a user's "Now Playing/Recently Played" list - requires Discord approval
            activities.write: allows your app to update a user's activity - requires Discord approval (NOT REQUIRED FOR GAMESDK ACTIVITY MANAGER)
            applications.builds.read: allows your app to read build data for a user's applications
            applications.builds.upload: allows your app to upload/update builds for a user's applications - requires Discord approval
            applications.commands: allows your app to use commands in a guild
            applications.commands.permissions.update: allows your app to update permissions for its commands in a guild a user has permissions to
            applications.entitlements: allows your app to read entitlements for a user's applications
            applications.store.update: allows your app to read and update store data (SKUs, store listings, achievements, etc.) for a user's applications
            bot: for oauth2 bots, this puts the bot in the user's selected guild by default
            connections: allows /users/@me/connections to return linked third-party accounts
            dm_channels.read: allows your app to see information about the user's DMs and group DMs - requires Discord approval
            email: enables /users/@me to return an email
            gdm.join: allows your app to join users to a group dm
            guilds: allows /users/@me/guilds to return basic information about all of a user's guilds
            guilds.join: allows /guilds/{guild.id}/members/{user.id} to be used for joining users to a guild
            guilds.members.read: allows /users/@me/guilds/{guild.id}/member to return a user's member information in a guild
            identify: allows /users/@me without email
            messages.read: for local rpc server api access, this allows you to read messages from all client channels (otherwise restricted to channels/guilds your app creates)
            openid: for OpenID Connect, this allows your app to receive user id and basic profile information
            relationships.read: allows your app to know a user's friends and implicit relationships - requires Discord approval
            rpc: for local rpc server access, this allows you to control a user's local Discord client - requires Discord approval
            rpc.activities.write: for local rpc server access, this allows you to update a user's activity - requires Discord approval
            rpc.notifications.read: for local rpc server access, this allows you to receive notifications pushed out to the user - requires Discord approval
            rpc.screenshare.read: for local rpc server access, this allows you to read a user's screenshare status- requires Discord approval
            rpc.screenshare.write: for local rpc server access, this allows you to update a user's screenshare settings- requires Discord approval
            rpc.video.read: for local rpc server access, this allows you to read a user's video status - requires Discord approval
            rpc.video.write: for local rpc server access, this allows you to update a user's video settings - requires Discord approval
            rpc.voice.read: for local rpc server access, this allows you to read a user's voice settings and listen for voice events - requires Discord approval
            rpc.voice.write: for local rpc server access, this allows you to update a user's voice settings - requires Discord approval
            voice: allows your app to connect to voice on user's behalf and see all the voice members - requires Discord approval
            webhook.incoming: this generates a webhook that is returned in the oauth token response for authorization code grants
        clientCredentials:
          tokenUrl: https://discord.com/api/oauth2/token
          refreshUrl: https://discord.com/api/oauth2/token
          scopes:
            activities.invites.write: allows your app to send activity invites - requires Discord approval (NOT REQUIRED FOR GAMESDK ACTIVITY MANAGER)
            activities.read: allows your app to fetch data from a user's "Now Playing/Recently Played" list - requires Discord approval
            activities.write: allows your app to update a user's activity - requires Discord approval (NOT REQUIRED FOR GAMESDK ACTIVITY MANAGER)
            applications.builds.read: allows your app to read build data for a user's applications
            applications.builds.upload: allows your app to upload/update builds for a user's applications - requires Discord approval
            applications.commands: allows your app to use commands in a guild
            applications.commands.permissions.update: allows your app to update permissions for its commands in a guild a user has permissions to
            applications.commands.update: allows your app to update its commands using a Bearer token - client credentials grant only
            applications.entitlements: allows your app to read entitlements for a user's applications
            applications.store.update: allows your app to read and update store data (SKUs, store listings, achievements, etc.) for a user's applications
            bot: for oauth2 bots, this puts the bot in the user's selected guild by default
            connections: allows /users/@me/connections to return linked third-party accounts
            dm_channels.read: allows your app to see information about the user's DMs and group DMs - requires Discord approval
            email: enables /users/@me to return an email
            gdm.join: allows your app to join users to a group dm
            guilds: allows /users/@me/guilds to return basic information about all of a user's guilds
            guilds.join: allows /guilds/{guild.id}/members/{user.id} to be used for joining users to a guild
            guilds.members.read: allows /users/@me/guilds/{guild.id}/member to return a user's member information in a guild
            identify: allows /users/@me without email
            messages.read: for local rpc server api access, this allows you to read messages from all client channels (otherwise restricted to channels/guilds your app creates)
            openid: for OpenID Connect, this allows your app to receive user id and basic profile information
            relationships.read: allows your app to know a user's friends and implicit relationships - requires Discord approval
            rpc: for local rpc server access, this allows you to control a user's local Discord client - requires Discord approval
            rpc.activities.write: for local rpc server access, this allows you to update a user's activity - requires Discord approval
            rpc.notifications.read: for local rpc server access, this allows you to receive notifications pushed out to the user - requires Discord approval
            rpc.screenshare.read: for local rpc server access, this allows you to read a user's screenshare status- requires Discord approval
            rpc.screenshare.write: for local rpc server access, this allows you to update a user's screenshare settings- requires Discord approval
            rpc.video.read: for local rpc server access, this allows you to read a user's video status - requires Discord approval
            rpc.video.write: for local rpc server access, this allows you to update a user's video settings - requires Discord approval
            rpc.voice.read: for local rpc server access, this allows you to read a user's voice settings and listen for voice events - requires Discord approval
            rpc.voice.write: for local rpc server access, this allows you to update a user's voice settings - requires Discord approval
            voice: allows your app to connect to voice on user's behalf and see all the voice members - requires Discord approval
            webhook.incoming: this generates a webhook that is returned in the oauth token response for authorization code grants
        authorizationCode:
          authorizationUrl: https://discord.com/api/oauth2/authorize
          tokenUrl: https://discord.com/api/oauth2/token
          refreshUrl: https://discord.com/api/oauth2/token
          scopes:
            activities.invites.write: allows your app to send activity invites - requires Discord approval (NOT REQUIRED FOR GAMESDK ACTIVITY MANAGER)
            activities.read: allows your app to fetch data from a user's "Now Playing/Recently Played" list - requires Discord approval
            activities.write: allows your app to update a user's activity - requires Discord approval (NOT REQUIRED FOR GAMESDK ACTIVITY MANAGER)
            applications.builds.read: allows your app to read build data for a user's applications
            applications.builds.upload: allows your app to upload/update builds for a user's applications - requires Discord approval
            applications.commands: allows your app to use commands in a guild
            applications.commands.permissions.update: allows your app to update permissions for its commands in a guild a user has permissions to
            applications.entitlements: allows your app to read entitlements for a user's applications
            applications.store.update: allows your app to read and update store data (SKUs, store listings, achievements, etc.) for a user's applications
            bot: for oauth2 bots, this puts the bot in the user's selected guild by default
            connections: allows /users/@me/connections to return linked third-party accounts
            dm_channels.read: allows your app to see information about the user's DMs and group DMs - requires Discord approval
            email: enables /users/@me to return an email
            gdm.join: allows your app to join users to a group dm
            guilds: allows /users/@me/guilds to return basic information about all of a user's guilds
            guilds.join: allows /guilds/{guild.id}/members/{user.id} to be used for joining users to a guild
            guilds.members.read: allows /users/@me/guilds/{guild.id}/member to return a user's member information in a guild
            identify: allows /users/@me without email
            messages.read: for local rpc server api access, this allows you to read messages from all client channels (otherwise restricted to channels/guilds your app creates)
            openid: for OpenID Connect, this allows your app to receive user id and basic profile information
            relationships.read: allows your app to know a user's friends and implicit relationships - requires Discord approval
            role_connections.write: allows your app to update a user's connection and metadata for the app
            rpc: for local rpc server access, this allows you to control a user's local Discord client - requires Discord approval
            rpc.activities.write: for local rpc server access, this allows you to update a user's activity - requires Discord approval
            rpc.notifications.read: for local rpc server access, this allows you to receive notifications pushed out to the user - requires Discord approval
            rpc.screenshare.read: for local rpc server access, this allows you to read a user's screenshare status- requires Discord approval
            rpc.screenshare.write: for local rpc server access, this allows you to update a user's screenshare settings- requires Discord approval
            rpc.video.read: for local rpc server access, this allows you to read a user's video status - requires Discord approval
            rpc.video.write: for local rpc server access, this allows you to update a user's video settings - requires Discord approval
            rpc.voice.read: for local rpc server access, this allows you to read a user's voice settings and listen for voice events - requires Discord approval
            rpc.voice.write: for local rpc server access, this allows you to update a user's voice settings - requires Discord approval
            voice: allows your app to connect to voice on user's behalf and see all the voice members - requires Discord approval
            webhook.incoming: this generates a webhook that is returned in the oauth token response for authorization code grants
externalDocs:
  url: https://discord.com/developers/docs
  description: Discord Developer Documentation
x-provenance:
  method: harvested
  publisher: Discord
  source: https://raw.githubusercontent.com/discord/discord-api-spec/HEAD/specs/openapi_preview.json
  note: split by refine-openapis from the provider's own published document, verified by fetch (openapi/_original/*.fetch.json);
    stamped by stamp-openapi-provenance.py (roadmap#793)