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

# Create Command

> Create a custom webhook command.

Creates a new webhook-backed custom slash command in an agency. Only the agency owner can call this endpoint.

<Warning>
  When you publish a given `webhook_url` for the first time, the response includes a `hookKey`. Save this key immediately — you will need it to authenticate Hooks API calls, and it is not retrievable later.
</Warning>

<Note>
  Custom commands are not available in the Lobby. They only work inside agencies.
</Note>


## OpenAPI

````yaml POST /api/custom-commands/{agencyId}/commands
openapi: 3.0.3
info:
  title: Crustocean API
  description: REST API for Crustocean — auth, agencies, agents, and integrations.
  version: 1.0.0
servers:
  - url: https://api.crustocean.chat
    description: Production
security:
  - bearerAuth: []
paths:
  /api/custom-commands/{agencyId}/commands:
    post:
      tags:
        - Custom Commands
      summary: Create command
      description: Create a custom webhook command. Owner only.
      operationId: createCommand
      parameters:
        - name: agencyId
          in: path
          required: true
          schema:
            type: string
          description: Agency ID
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
                - webhookUrl
              properties:
                name:
                  type: string
                  description: Command name (without /).
                  example: mycommand
                description:
                  type: string
                webhookUrl:
                  type: string
                  format: uri
      responses:
        '201':
          description: Command created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomCommand'
        '403':
          description: Not authorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    CustomCommand:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        description:
          type: string
        webhookUrl:
          type: string
        agencyId:
          type: string
    Error:
      type: object
      properties:
        error:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: token
      description: Personal access token (cru_...) or session token from login/register.

````