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

# API overview

> Manage SaaS Mode customers, customer channels, and webhooks by API.

Use the SaaS Mode API to manage messaging inside your app or SaaS:

* create and list customers
* create onboarding links for customer channel connection
* list customer channels and fetch channel tokens
* set webhook destinations
* register agent credentials for headless automation

## Authentication

Use two tokens:

| Token                 | Use it for                                                                     | Base URL                             |
| --------------------- | ------------------------------------------------------------------------------ | ------------------------------------ |
| `hmok_` API key       | Manage your org, customers, customer channels, webhooks, and agent credentials | `https://api.hookmyapp.com`          |
| `hmat_` channel token | Send messages through one customer channel                                     | `https://gateway.hookmyapp.com/meta` |

Use an `hmok_` API key for org and customer management. An `hmok_` key belongs to one organization. The key creation response includes `organizationPublicId` (`org_...`). Use it in organization routes.

Customer-channel routes, such as channels and webhooks, also need the customer's `ws_` ID in `X-Workspace-Id`.

```bash theme={null}
curl https://api.hookmyapp.com/meta/channels \
  -H "Authorization: Bearer hmok_..." \
  -H "X-Workspace-Id: ws_..."
```

## List customers

List customers from your organization:

```bash theme={null}
curl "https://api.hookmyapp.com/organizations/{ORG_PUBLIC_ID}/workspaces?kind=customer" \
  -H "Authorization: Bearer hmok_..."
```

Use the customer's `ws_` ID when you list that customer's channels:

```bash theme={null}
curl https://api.hookmyapp.com/meta/channels \
  -H "Authorization: Bearer hmok_..." \
  -H "X-Workspace-Id: ws_..."
```

Message sends use the `hmat_` token returned by `GET /meta/channels/{id}/token`.

```bash theme={null}
curl https://api.hookmyapp.com/meta/channels/{channelId}/token \
  -H "Authorization: Bearer hmok_..." \
  -H "X-Workspace-Id: ws_..."
```

Then send with the `hmat_` token:

```bash WhatsApp theme={null}
curl -X POST https://gateway.hookmyapp.com/meta/v22.0/{PHONE_NUMBER_ID}/messages \
  -H "Authorization: Bearer hmat_..." \
  -H "Content-Type: application/json" \
  -d '{"messaging_product":"whatsapp","to":"15551234567","type":"text","text":{"body":"Hello"}}'
```

<Note>
  The version-pinned base URL (`.../meta/v22.0` for WhatsApp, `.../meta/v25.0`
  for Instagram) is the exact value HookMyApp emits as `META_GRAPH_API_URL`
  from `hookmyapp channels env <channel>`. Read the base URL from that variable
  instead of hardcoding the version, so a Meta Graph API version bump doesn't
  leave your requests pinned to an old version.
</Note>

## Next steps

* [Send a message](/saas-mode/api/messages/send-message): Send through a customer channel.
* [Onboarding links](/saas-mode/onboarding-links): Let customers connect their own channels.
