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

# Execute a Slash Command

> Execute a slash command in the specified room.
### Changelog
| Version      | Description |
| ---------------- | ------------|
|3.0.0      | Added `triggerId` property       |
|2.0.0      | Added `tmid` property      |
|0.60.2      | Added        |

## OpenAPI

````json POST /api/v1/commands.run
{
  "openapi": "3.0.0",
  "info": {
    "version": "1.0.0",
    "title": "Miscellaneous"
  },
  "servers": [
    {
      "url": "https://apiexplorer.support.rocket.chat"
    }
  ],
  "paths": {
    "/api/v1/commands.run": {
      "post": {
        "tags": [
          "Commands"
        ],
        "summary": "Execute a Slash Command",
        "description": "Execute a slash command in the specified room.\n### Changelog\n| Version      | Description |\n| ---------------- | ------------|\n|3.0.0      | Added `triggerId` property       |\n|2.0.0      | Added `tmid` property      |\n|0.60.2      | Added        |",
        "operationId": "post-api-v1-commands.run",
        "parameters": [
          {
            "$ref": "#/components/parameters/Auth-Token"
          },
          {
            "$ref": "#/components/parameters/UserId"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "command": {
                    "type": "string",
                    "description": "The name of the command to be executed."
                  },
                  "roomId": {
                    "type": "string",
                    "description": "The ID of the room."
                  },
                  "params": {
                    "type": "string",
                    "description": "Parameters of the command if required. It is `undefined` by default"
                  },
                  "tmid": {
                    "type": "string",
                    "description": "The ID of the thread to run the command."
                  },
                  "triggerId": {
                    "type": "string",
                    "description": "The triggerId generated by the client that allows the command to interact with the UI"
                  }
                },
                "required": [
                  "command",
                  "roomId"
                ]
              },
              "examples": {
                "Success": {
                  "value": {
                    "command": "unmute",
                    "roomId": "ByehQjC44FwMeiLbX",
                    "params": "@user123",
                    "tmid": "Hsj2435g4bvrj4bjh",
                    "triggerId": "awovufbukuefzuper"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/trueSuccess"
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "error": {
                      "type": "string"
                    }
                  }
                },
                "examples": {
                  "Example 1": {
                    "value": {
                      "success": "false",
                      "error": "You must provide a command to run."
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/authorizationError"
          }
        }
      }
    }
  },
  "components": {
    "parameters": {
      "Auth-Token": {
        "name": "X-Auth-Token",
        "in": "header",
        "description": "The `authToken` of the authenticated user.",
        "required": "true",
        "schema": {
          "type": "string"
        },
        "example": "RScctEHSmLGZGywfIhWyRpyofhKOiMoUIpimhvheU3f"
      },
      "UserId": {
        "name": "X-User-Id",
        "in": "header",
        "description": "The `userId` of the authenticated user.",
        "required": "true",
        "schema": {
          "type": "string"
        },
        "example": "rbAXPnMktTFbNpwtJ"
      }
    },
    "responses": {
      "trueSuccess": {
        "description": "OK",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "success": {
                  "type": "boolean"
                }
              }
            },
            "examples": {
              "Success": {
                "value": {
                  "success": "true"
                }
              }
            }
          }
        }
      },
      "authorizationError": {
        "description": "Unauthorized",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "status": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            },
            "examples": {
              "Authorization Error": {
                "value": {
                  "status": "error",
                  "message": "You must be logged in to do this."
                }
              }
            }
          }
        }
      }
    }
  }
}
````

