Discord Interactions API

The Discord Interactions API enables applications to create and respond to application commands (slash commands), message components, and modals. It supports both Gateway-based and webhook-based interaction handling, allowing bots to build rich, interactive user experiences within Discord.

OpenAPI Specification

discord-interactions-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Discord Interactions API
  description: >-
    The Discord Interactions API enables applications to create and respond
    to application commands (slash commands), message components, and modals.
    It supports both Gateway-based and webhook-based interaction handling,
    allowing bots to build rich, interactive user experiences within Discord.
  version: '10'
  contact:
    name: Discord Support
    url: https://support-dev.discord.com/hc/en-us
    email: [email protected]
  termsOfService: https://discord.com/developers/docs/policies-and-agreements/developer-terms-of-service
externalDocs:
  description: Discord Interactions Documentation
  url: https://discord.com/developers/docs/interactions/overview
servers:
  - url: https://discord.com/api/v10
    description: Discord API v10
tags:
  - name: Application Commands
    description: Manage global and guild application commands
  - name: Interaction Responses
    description: Respond to interactions received from Discord
security:
  - BotToken: []
paths:
  /applications/{application_id}/commands:
    get:
      operationId: getGlobalApplicationCommands
      summary: Discord List global application commands
      description: Fetch all of the global commands for your application.
      tags:
        - Application Commands
      parameters:
        - $ref: '#/components/parameters/applicationId'
        - name: with_localizations
          in: query
          schema:
            type: boolean
      responses:
        '200':
          description: List of application command objects
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ApplicationCommand'
        4XX:
          $ref: '#/components/responses/ClientError'
    post:
      operationId: createGlobalApplicationCommand
      summary: Discord Create global application command
      description: >-
        Create a new global command. Returns 201 if a command with the same
        name does not already exist, or a 200 if it does.
      tags:
        - Application Commands
      parameters:
        - $ref: '#/components/parameters/applicationId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateApplicationCommandRequest'
      responses:
        '200':
          description: Updated command (name already exists)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApplicationCommand'
        '201':
          description: Command created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApplicationCommand'
        4XX:
          $ref: '#/components/responses/ClientError'
    put:
      operationId: bulkOverwriteGlobalApplicationCommands
      summary: Discord Bulk overwrite global application commands
      description: >-
        Overwrites all existing global commands. Commands not in the payload
        will be deleted.
      tags:
        - Application Commands
      parameters:
        - $ref: '#/components/parameters/applicationId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/CreateApplicationCommandRequest'
      responses:
        '200':
          description: List of application command objects
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ApplicationCommand'
        4XX:
          $ref: '#/components/responses/ClientError'
  /applications/{application_id}/commands/{command_id}:
    get:
      operationId: getGlobalApplicationCommand
      summary: Discord Get global application command
      description: Fetch a global command for your application.
      tags:
        - Application Commands
      parameters:
        - $ref: '#/components/parameters/applicationId'
        - $ref: '#/components/parameters/commandId'
      responses:
        '200':
          description: Application command object
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApplicationCommand'
        4XX:
          $ref: '#/components/responses/ClientError'
    patch:
      operationId: editGlobalApplicationCommand
      summary: Discord Edit global application command
      description: Edit a global command. Returns the updated command object.
      tags:
        - Application Commands
      parameters:
        - $ref: '#/components/parameters/applicationId'
        - $ref: '#/components/parameters/commandId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EditApplicationCommandRequest'
      responses:
        '200':
          description: Updated application command object
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApplicationCommand'
        4XX:
          $ref: '#/components/responses/ClientError'
    delete:
      operationId: deleteGlobalApplicationCommand
      summary: Discord Delete global application command
      description: Deletes a global command.
      tags:
        - Application Commands
      parameters:
        - $ref: '#/components/parameters/applicationId'
        - $ref: '#/components/parameters/commandId'
      responses:
        '204':
          description: Command deleted
        4XX:
          $ref: '#/components/responses/ClientError'
  /applications/{application_id}/guilds/{guild_id}/commands:
    get:
      operationId: getGuildApplicationCommands
      summary: Discord List guild application commands
      description: Fetch all of the guild commands for your application for a specific guild.
      tags:
        - Application Commands
      parameters:
        - $ref: '#/components/parameters/applicationId'
        - $ref: '#/components/parameters/guildId'
        - name: with_localizations
          in: query
          schema:
            type: boolean
      responses:
        '200':
          description: List of application command objects
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ApplicationCommand'
        4XX:
          $ref: '#/components/responses/ClientError'
    post:
      operationId: createGuildApplicationCommand
      summary: Discord Create guild application command
      description: Create a new guild command.
      tags:
        - Application Commands
      parameters:
        - $ref: '#/components/parameters/applicationId'
        - $ref: '#/components/parameters/guildId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateApplicationCommandRequest'
      responses:
        '200':
          description: Updated command
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApplicationCommand'
        '201':
          description: Command created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApplicationCommand'
        4XX:
          $ref: '#/components/responses/ClientError'
    put:
      operationId: bulkOverwriteGuildApplicationCommands
      summary: Discord Bulk overwrite guild application commands
      description: Overwrites all existing guild commands for your application.
      tags:
        - Application Commands
      parameters:
        - $ref: '#/components/parameters/applicationId'
        - $ref: '#/components/parameters/guildId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/CreateApplicationCommandRequest'
      responses:
        '200':
          description: List of application command objects
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ApplicationCommand'
        4XX:
          $ref: '#/components/responses/ClientError'
  /applications/{application_id}/guilds/{guild_id}/commands/{command_id}:
    get:
      operationId: getGuildApplicationCommand
      summary: Discord Get guild application command
      description: Fetch a guild command for your application.
      tags:
        - Application Commands
      parameters:
        - $ref: '#/components/parameters/applicationId'
        - $ref: '#/components/parameters/guildId'
        - $ref: '#/components/parameters/commandId'
      responses:
        '200':
          description: Application command object
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApplicationCommand'
        4XX:
          $ref: '#/components/responses/ClientError'
    patch:
      operationId: editGuildApplicationCommand
      summary: Discord Edit guild application command
      description: Edit a guild command.
      tags:
        - Application Commands
      parameters:
        - $ref: '#/components/parameters/applicationId'
        - $ref: '#/components/parameters/guildId'
        - $ref: '#/components/parameters/commandId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EditApplicationCommandRequest'
      responses:
        '200':
          description: Updated application command
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApplicationCommand'
        4XX:
          $ref: '#/components/responses/ClientError'
    delete:
      operationId: deleteGuildApplicationCommand
      summary: Discord Delete guild application command
      description: Delete a guild command.
      tags:
        - Application Commands
      parameters:
        - $ref: '#/components/parameters/applicationId'
        - $ref: '#/components/parameters/guildId'
        - $ref: '#/components/parameters/commandId'
      responses:
        '204':
          description: Command deleted
        4XX:
          $ref: '#/components/responses/ClientError'
  /applications/{application_id}/guilds/{guild_id}/commands/permissions:
    get:
      operationId: getGuildApplicationCommandPermissions
      summary: Discord List guild application command permissions
      description: Fetches permissions for all commands in a guild.
      tags:
        - Application Commands
      parameters:
        - $ref: '#/components/parameters/applicationId'
        - $ref: '#/components/parameters/guildId'
      responses:
        '200':
          description: List of guild application command permissions
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/GuildApplicationCommandPermissions'
        4XX:
          $ref: '#/components/responses/ClientError'
  /applications/{application_id}/guilds/{guild_id}/commands/{command_id}/permissions:
    get:
      operationId: getApplicationCommandPermissions
      summary: Discord Get application command permissions
      description: Fetches permissions for a specific command in a guild.
      tags:
        - Application Commands
      parameters:
        - $ref: '#/components/parameters/applicationId'
        - $ref: '#/components/parameters/guildId'
        - $ref: '#/components/parameters/commandId'
      responses:
        '200':
          description: Guild application command permissions object
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GuildApplicationCommandPermissions'
        4XX:
          $ref: '#/components/responses/ClientError'
    put:
      operationId: editApplicationCommandPermissions
      summary: Discord Edit application command permissions
      description: >-
        Edits command permissions for a specific command in a guild. Requires
        Bearer token with applications.commands.permissions.update scope.
      tags:
        - Application Commands
      parameters:
        - $ref: '#/components/parameters/applicationId'
        - $ref: '#/components/parameters/guildId'
        - $ref: '#/components/parameters/commandId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - permissions
              properties:
                permissions:
                  type: array
                  items:
                    $ref: '#/components/schemas/ApplicationCommandPermission'
      responses:
        '200':
          description: Updated permissions
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GuildApplicationCommandPermissions'
        4XX:
          $ref: '#/components/responses/ClientError'
  /interactions/{interaction_id}/{interaction_token}/callback:
    post:
      operationId: createInteractionResponse
      summary: Discord Create interaction response
      description: >-
        Create a response to an interaction from the gateway or webhook.
        Takes an interaction response object.
      tags:
        - Interaction Responses
      security: []
      parameters:
        - name: interaction_id
          in: path
          required: true
          schema:
            type: string
        - name: interaction_token
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InteractionResponse'
      responses:
        '200':
          description: Interaction callback response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InteractionCallbackResponse'
        '204':
          description: Interaction response accepted
        4XX:
          $ref: '#/components/responses/ClientError'
  /webhooks/{application_id}/{interaction_token}/messages/@original:
    get:
      operationId: getOriginalInteractionResponse
      summary: Discord Get original interaction response
      description: Returns the initial Interaction response.
      tags:
        - Interaction Responses
      security: []
      parameters:
        - $ref: '#/components/parameters/applicationId'
        - name: interaction_token
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Message object
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Message'
        4XX:
          $ref: '#/components/responses/ClientError'
    patch:
      operationId: editOriginalInteractionResponse
      summary: Discord Edit original interaction response
      description: Edits the initial Interaction response.
      tags:
        - Interaction Responses
      security: []
      parameters:
        - $ref: '#/components/parameters/applicationId'
        - name: interaction_token
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EditMessageRequest'
      responses:
        '200':
          description: Updated message
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Message'
        4XX:
          $ref: '#/components/responses/ClientError'
    delete:
      operationId: deleteOriginalInteractionResponse
      summary: Discord Delete original interaction response
      description: Deletes the initial Interaction response.
      tags:
        - Interaction Responses
      security: []
      parameters:
        - $ref: '#/components/parameters/applicationId'
        - name: interaction_token
          in: path
          required: true
          schema:
            type: string
      responses:
        '204':
          description: Response deleted
        4XX:
          $ref: '#/components/responses/ClientError'
  /webhooks/{application_id}/{interaction_token}:
    post:
      operationId: createFollowupMessage
      summary: Discord Create followup message
      description: Create a followup message for an Interaction.
      tags:
        - Interaction Responses
      security: []
      parameters:
        - $ref: '#/components/parameters/applicationId'
        - name: interaction_token
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateMessageRequest'
      responses:
        '200':
          description: Followup message
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Message'
        4XX:
          $ref: '#/components/responses/ClientError'
  /webhooks/{application_id}/{interaction_token}/messages/{message_id}:
    get:
      operationId: getFollowupMessage
      summary: Discord Get followup message
      description: Returns a followup message for an Interaction.
      tags:
        - Interaction Responses
      security: []
      parameters:
        - $ref: '#/components/parameters/applicationId'
        - name: interaction_token
          in: path
          required: true
          schema:
            type: string
        - name: message_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Message object
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Message'
        4XX:
          $ref: '#/components/responses/ClientError'
    patch:
      operationId: editFollowupMessage
      summary: Discord Edit followup message
      description: Edits a followup message for an Interaction.
      tags:
        - Interaction Responses
      security: []
      parameters:
        - $ref: '#/components/parameters/applicationId'
        - name: interaction_token
          in: path
          required: true
          schema:
            type: string
        - name: message_id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EditMessageRequest'
      responses:
        '200':
          description: Updated message
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Message'
        4XX:
          $ref: '#/components/responses/ClientError'
    delete:
      operationId: deleteFollowupMessage
      summary: Discord Delete followup message
      description: Deletes a followup message for an Interaction.
      tags:
        - Interaction Responses
      security: []
      parameters:
        - $ref: '#/components/parameters/applicationId'
        - name: interaction_token
          in: path
          required: true
          schema:
            type: string
        - name: message_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '204':
          description: Message deleted
        4XX:
          $ref: '#/components/responses/ClientError'
components:
  securitySchemes:
    BotToken:
      type: http
      scheme: bearer
      description: Bot token authentication
  parameters:
    applicationId:
      name: application_id
      in: path
      required: true
      schema:
        type: string
      description: The ID of the application
    guildId:
      name: guild_id
      in: path
      required: true
      schema:
        type: string
      description: The ID of the guild
    commandId:
      name: command_id
      in: path
      required: true
      schema:
        type: string
      description: The ID of the command
  responses:
    ClientError:
      description: Client error response
      content:
        application/json:
          schema:
            type: object
            properties:
              code:
                type: integer
              message:
                type: string
  schemas:
    Snowflake:
      type: string
      pattern: '^[0-9]+$'
    ApplicationCommand:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/Snowflake'
        type:
          type: integer
          description: 1=CHAT_INPUT, 2=USER, 3=MESSAGE
        application_id:
          $ref: '#/components/schemas/Snowflake'
        guild_id:
          $ref: '#/components/schemas/Snowflake'
        name:
          type: string
          minLength: 1
          maxLength: 32
        name_localizations:
          type: object
          additionalProperties:
            type: string
          nullable: true
        description:
          type: string
          maxLength: 100
        description_localizations:
          type: object
          additionalProperties:
            type: string
          nullable: true
        options:
          type: array
          items:
            $ref: '#/components/schemas/ApplicationCommandOption'
          maxItems: 25
        default_member_permissions:
          type: string
          nullable: true
        dm_permission:
          type: boolean
        default_permission:
          type: boolean
          deprecated: true
        nsfw:
          type: boolean
        version:
          $ref: '#/components/schemas/Snowflake'
      required:
        - id
        - application_id
        - name
        - description
    ApplicationCommandOption:
      type: object
      properties:
        type:
          type: integer
          description: >-
            1=SUB_COMMAND, 2=SUB_COMMAND_GROUP, 3=STRING, 4=INTEGER,
            5=BOOLEAN, 6=USER, 7=CHANNEL, 8=ROLE, 9=MENTIONABLE,
            10=NUMBER, 11=ATTACHMENT
        name:
          type: string
          minLength: 1
          maxLength: 32
        name_localizations:
          type: object
          additionalProperties:
            type: string
          nullable: true
        description:
          type: string
          minLength: 1
          maxLength: 100
        description_localizations:
          type: object
          additionalProperties:
            type: string
          nullable: true
        required:
          type: boolean
        choices:
          type: array
          items:
            $ref: '#/components/schemas/ApplicationCommandOptionChoice'
          maxItems: 25
        options:
          type: array
          items:
            $ref: '#/components/schemas/ApplicationCommandOption'
          maxItems: 25
        channel_types:
          type: array
          items:
            type: integer
        min_value:
          type: number
        max_value:
          type: number
        min_length:
          type: integer
          minimum: 0
          maximum: 6000
        max_length:
          type: integer
          minimum: 1
          maximum: 6000
        autocomplete:
          type: boolean
      required:
        - type
        - name
        - description
    ApplicationCommandOptionChoice:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 100
        name_localizations:
          type: object
          additionalProperties:
            type: string
          nullable: true
        value:
          oneOf:
            - type: string
            - type: integer
            - type: number
      required:
        - name
        - value
    ApplicationCommandPermission:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/Snowflake'
        type:
          type: integer
          description: 1=ROLE, 2=USER, 3=CHANNEL
        permission:
          type: boolean
      required:
        - id
        - type
        - permission
    GuildApplicationCommandPermissions:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/Snowflake'
        application_id:
          $ref: '#/components/schemas/Snowflake'
        guild_id:
          $ref: '#/components/schemas/Snowflake'
        permissions:
          type: array
          items:
            $ref: '#/components/schemas/ApplicationCommandPermission'
      required:
        - id
        - application_id
        - guild_id
        - permissions
    InteractionResponse:
      type: object
      required:
        - type
      properties:
        type:
          type: integer
          description: >-
            1=PONG, 4=CHANNEL_MESSAGE_WITH_SOURCE,
            5=DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE,
            6=DEFERRED_UPDATE_MESSAGE, 7=UPDATE_MESSAGE,
            8=APPLICATION_COMMAND_AUTOCOMPLETE_RESULT,
            9=MODAL, 10=PREMIUM_REQUIRED
        data:
          $ref: '#/components/schemas/InteractionCallbackData'
    InteractionCallbackData:
      type: object
      properties:
        tts:
          type: boolean
        content:
          type: string
          maxLength: 2000
        embeds:
          type: array
          items:
            $ref: '#/components/schemas/Embed'
          maxItems: 10
        allowed_mentions:
          type: object
          properties:
            parse:
              type: array
              items:
                type: string
            roles:
              type: array
              items:
                type: string
            users:
              type: array
              items:
                type: string
            replied_user:
              type: boolean
        flags:
          type: integer
          description: Set to 64 for ephemeral messages
        components:
          type: array
          items:
            type: object
        choices:
          type: array
          items:
            $ref: '#/components/schemas/ApplicationCommandOptionChoice'
          description: Used for autocomplete responses
        custom_id:
          type: string
          description: Used for modal responses
        title:
          type: string
          description: Used for modal responses
    InteractionCallbackResponse:
      type: object
      properties:
        interaction:
          type: object
          properties:
            id:
              $ref: '#/components/schemas/Snowflake'
            type:
              type: integer
            activity_instance_id:
              type: string
            response_message_id:
              $ref: '#/components/schemas/Snowflake'
            response_message_loading:
              type: boolean
            response_message_ephemeral:
              type: boolean
        resource:
          type: object
          properties:
            type:
              type: integer
            message:
              $ref: '#/components/schemas/Message'
    Embed:
      type: object
      properties:
        title:
          type: string
        description:
          type: string
        url:
          type: string
          format: uri
        color:
          type: integer
        fields:
          type: array
          items:
            type: object
            required:
              - name
              - value
            properties:
              name:
                type: string
              value:
                type: string
              inline:
                type: boolean
    Message:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/Snowflake'
        channel_id:
          $ref: '#/components/schemas/Snowflake'
        content:
          type: string
        timestamp:
          type: string
          format: date-time
        flags:
          type: integer
    CreateApplicationCommandRequest:
      type: object
      required:
        - name
        - description
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 32
        name_localizations:
          type: object
          additionalProperties:
            type: string
          nullable: true
        description:
          type: string
          maxLength: 100
        description_localizations:
          type: object
          additionalProperties:
            type: string
          nullable: true
        options:
          type: array
          items:
            $ref: '#/components/schemas/ApplicationCommandOption'
          maxItems: 25
        default_member_permissions:
          type: string
          nullable: true
        dm_permission:
          type: boolean
        type:
          type: integer
          default: 1
        nsfw:
          type: boolean
    EditApplicationCommandRequest:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 32
        description:
          type: string
          maxLength: 100
        options:
          type: array
          items:
            $ref: '#/components/schemas/ApplicationCommandOption'
          maxItems: 25
        default_member_permissions:
          type: string
          nullable: true
        dm_permission:
          type: boolean
        nsfw:
          type: boolean
    CreateMessageRequest:
      type: object
      properties:
        content:
          type: string
          maxLength: 2000
        embeds:
          type: array
          items:
            $ref: '#/components/schemas/Embed'
          maxItems: 10
        flags:
          type: integer
        components:
          type: array
          items:
            type: object
    EditMessageRequest:
      type: object
      properties:
        content:
          type: string
          nullable: true
          maxLength: 2000
        embeds:
          type: array
          nullable: true
          items:
            $ref: '#/components/schemas/Embed'
          maxItems: 10
        components:
          type: array
          nullable: true
          items:
            type: object