> ## Documentation Index
> Fetch the complete documentation index at: https://docs.discordbotlist.lol/llms.txt
> Use this file to discover all available pages before exploring further.

# Publish the commands

> Replace the commands shown on the bot's page. PUT rather than POST on purpose: a bot that removed a command has to be able to say so, and a merge would leave the removed one on the page with nothing able to delete it.

The shape mirrors Discord's own application command objects, so a bot can forward what it already registered. Duplicate names are dropped, keeping the first. An empty array clears the list. Rate limit: 10 requests per minute per token -- enough to clear a restart loop, not a stream.



## OpenAPI

````yaml /openapi.json put /api/v1/bots/{id}/commands
openapi: 3.1.0
info:
  title: Discord Bot List API
  version: 1.0.0
  description: >-
    Everything under /api/v1 acts on one listing: the token identifies the bot,
    and the id in the path has to be that same bot. A mismatch answers 404
    rather than 403, so a token cannot be used to discover which other bots
    exist.
  contact:
    name: Support
    url: https://discordbotlist.lol/contact
  license:
    name: Terms of Service
    url: https://discordbotlist.lol/terms
servers:
  - url: https://discordbotlist.lol
    description: Production
security:
  - botToken: []
paths:
  /api/v1/bots/{id}/commands:
    put:
      tags:
        - Bot
      summary: Publish the commands
      description: >-
        Replace the commands shown on the bot's page. PUT rather than POST on
        purpose: a bot that removed a command has to be able to say so, and a
        merge would leave the removed one on the page with nothing able to
        delete it.


        The shape mirrors Discord's own application command objects, so a bot
        can forward what it already registered. Duplicate names are dropped,
        keeping the first. An empty array clears the list. Rate limit: 10
        requests per minute per token -- enough to clear a restart loop, not a
        stream.
      operationId: putCommands
      parameters:
        - $ref: '#/components/parameters/botId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - commands
              properties:
                commands:
                  type: array
                  maxItems: 100
                  items:
                    type: object
                    required:
                      - name
                      - description
                    properties:
                      name:
                        type: string
                        minLength: 1
                        maxLength: 32
                        description: >-
                          Discord's own bound: a list Discord accepted is a list
                          this accepts.
                      description:
                        type: string
                        minLength: 1
                        maxLength: 100
            example:
              commands:
                - name: ban
                  description: Ban a member
                - name: warn
                  description: Warn a member and log it
      responses:
        '200':
          description: Stored. count is what survived de-duplication.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  count:
                    type: integer
              example:
                success: true
                count: 2
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  parameters:
    botId:
      name: id
      in: path
      required: true
      description: >-
        The bot's Discord application id. It has to be the bot the token belongs
        to.
      schema:
        type: string
        pattern: ^\d{17,19}$
      example: '1092194789458481202'
  responses:
    BadRequest:
      description: The body or a query parameter is malformed.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: Invalid JSON body.
    Unauthorized:
      description: Missing, malformed or unknown token.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: Invalid token.
    NotFound:
      description: No such bot, or the token belongs to a different one.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: Bot not found.
    RateLimited:
      description: Rate limit exceeded.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: Rate limit exceeded.
            retryAfter: 42
  schemas:
    Error:
      type: object
      properties:
        error:
          type: string
          description: One sentence, safe to show a developer.
        retryAfter:
          type: integer
          description: Seconds until the limit resets. Only on 429.
      required:
        - error
  securitySchemes:
    botToken:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        The bot's API token, generated on its edit page. Sent bare or as `Bearer
        <token>` -- both are accepted, because the libraries already posting to
        other lists send both. The token is shown once; generating a new one
        invalidates the old.

````