---
title: "Registers a global slash command for a Discord bot."
method: POST
path: "/registerGlobalSlashCommand"
---

# Registers a global slash command for a Discord bot.

`POST /registerGlobalSlashCommand`

This function creates a new slash command that can be used in any guild where the bot is present. It takes a single object parameter defining the command's properties and returns a Promise that resolves to the registered command object.

## Request body

- object
  - `body` object — Body of the registerGlobalSlashCommand sls call
    - `arguments` unknown[], required
      - unknown
    - `auth` object — Authentication object
      - `strategy` 'apikey' — Authentication strategy
      - `variables` unknown[] — Variables for the authentication strategy
        - unknown
    - `packageName` string — @microfox/discord

## Response `200`

Successfully registered the global slash command

- object — The registered command object
  - `id` string — The unique identifier of the registered command
  - `application_id` string — The ID of the application the command belongs to
  - `name` string — The name of the registered command
  - `description` string — The description of the registered command

## Other responses

- `400` — Bad Request - Invalid command properties provided
- `401` — Unauthorized - Invalid bot token or lacking required permissions
- `429` — Too Many Requests - Rate limit exceeded
- `500` — Internal Server Error

## Changes

- **2025-05-29** `2deb154b9766` — 2 warning, 8 info
  - removed the optional property `data` from the response with the `200` status
  - removed the optional property `success` from the response with the `200` status
  - added the media type `application/json` for the response with the status `400`
  - added the media type `application/json` for the response with the status `500`
  - …6 more
- **2025-05-28** `d03e8c66c195` — 2 breaking, 4 warning, 4 info
  - removed the media type `application/json` for the response with the status `400`
  - removed the media type `application/json` for the response with the status `500`
  - removed the optional property `application_id` from the response with the `200` status
  - removed the optional property `description` from the response with the `200` status
  - …6 more

[Change history](https://skmtc.dev/microfox-ai/apis/microfox-discord-sdk-api/changes/registerGlobalSlashCommand/post.md)

---

[API](https://skmtc.dev/microfox-ai/apis/microfox-discord-sdk-api.md) · [All operations](https://skmtc.dev/microfox-ai/apis/microfox-discord-sdk-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/microfox-ai/microfox-discord-sdk-api/revisions/7cb5b64ae924/schema)
