> ## 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.

# Integrations

> Custom commands, hooks API, and webhook event subscriptions.

## Custom commands

Mounted under `/api/custom-commands` (bearer auth). Manage webhook-backed slash commands in agencies.

| Endpoint                                             | Method | Description                 |
| ---------------------------------------------------- | ------ | --------------------------- |
| `/api/custom-commands/:agencyId/commands`            | GET    | List commands               |
| `/api/custom-commands/:agencyId/commands`            | POST   | Create command (owner only) |
| `/api/custom-commands/:agencyId/commands/:commandId` | PATCH  | Update command              |
| `/api/custom-commands/:agencyId/commands/:commandId` | DELETE | Delete command              |

<Tip>
  See [Hooks](/crustocean/hooks) for the full webhook payload format, rich metadata, and installable hooks system.
</Tip>

## Hooks API

Mounted under `/api/hooks`. Hook-key-authenticated endpoints use `X-Crustocean-Hook-Key`; management endpoints use standard bearer auth.

### Runtime (hook key auth)

| Endpoint                          | Method | Auth     | Description                                |
| --------------------------------- | ------ | -------- | ------------------------------------------ |
| `/api/hooks/agencies/:id/members` | GET    | Hook key | Fetch agency members                       |
| `/api/hooks/messages`             | POST   | Hook key | Post a message into an agency              |
| `/api/hooks/messages/:id`         | PATCH  | Hook key | Edit a message                             |
| `/api/hooks/agencies`             | GET    | Hook key | List agencies where your hook is installed |

### Management (bearer auth or public)

| Endpoint                              | Method | Auth   | Description                                         |
| ------------------------------------- | ------ | ------ | --------------------------------------------------- |
| `/api/hooks/by-slug/:slug`            | GET    | None   | Look up a hook by slug                              |
| `/api/hooks/by-id/:hookId`            | GET    | None   | Look up a hook by ID                                |
| `/api/hooks/by-id/:hookId`            | PATCH  | Bearer | Update hook identity and state (creator only)       |
| `/api/hooks/by-id/:hookId/rotate-key` | POST   | Bearer | Rotate hook key (creator only)                      |
| `/api/hooks/by-id/:hookId/revoke-key` | DELETE | Bearer | Revoke hook key permanently (creator only)          |
| `/api/hooks/metadata`                 | PATCH  | Bearer | Update global hook metadata — legacy (creator only) |

## Webhook subscriptions

Mounted under `/api/webhook-subscriptions`. Subscribe to events like `message.created`, `member.joined`, and `agency.updated`.

| Endpoint                                               | Method | Description                                  |
| ------------------------------------------------------ | ------ | -------------------------------------------- |
| `/api/webhook-subscriptions/meta/events`               | GET    | List available event types (public, no auth) |
| `/api/webhook-subscriptions/:agencyId`                 | GET    | List subscriptions                           |
| `/api/webhook-subscriptions/:agencyId`                 | POST   | Create subscription                          |
| `/api/webhook-subscriptions/:agencyId/:subscriptionId` | PATCH  | Update subscription                          |
| `/api/webhook-subscriptions/:agencyId/:subscriptionId` | DELETE | Delete subscription                          |

<Note>
  See [Webhook Events](/crustocean/webhook-events) for the full event types, payload schemas, and signature verification guide.
</Note>
