Discord Application Commands API

Manage global and guild application commands

OpenAPI Specification

discord-application-commands-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Discord Interactions Application Commands 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: support@discord.com
  termsOfService: https://discord.com/developers/docs/policies-and-agreements/developer-terms-of-service
servers:
- url: https://discord.com/api/v10
  description: Discord API v10
security:
- BotToken: []
tags:
- name: Application Commands
  description: Manage global and guild application commands
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'
components:
  parameters:
    guildId:
      name: guild_id
      in: path
      required: true
      schema:
        type: string
      description: The ID of the guild
    applicationId:
      name: application_id
      in: path
      required: true
      schema:
        type: string
      description: The ID of the application
    commandId:
      name: command_id
      in: path
      required: true
      schema:
        type: string
      description: The ID of the command
  schemas:
    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
    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
    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
    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
    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
    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
    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
    Snowflake:
      type: string
      pattern: ^[0-9]+$
  responses:
    ClientError:
      description: Client error response
      content:
        application/json:
          schema:
            type: object
            properties:
              code:
                type: integer
              message:
                type: string
  securitySchemes:
    BotToken:
      type: http
      scheme: bearer
      description: Bot token authentication
externalDocs:
  description: Discord Interactions Documentation
  url: https://discord.com/developers/docs/interactions/overview