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

> Use the HookMyApp public API for Instagram.

## What you can do

* send Instagram DMs through your connected account
* receive incoming DMs, reactions, reads, and message events in your webhook
* list connected channels and fetch channel tokens
* set or clear the webhook destination for a channel
* rotate a channel token if it leaks
* publish images, reels, stories, and carousels
* read account and media insights
* list, reply to, hide, and delete comments

## Authentication

Use two tokens:

| Token                 | Use it for                                                                                    | Base URL                                   |
| --------------------- | --------------------------------------------------------------------------------------------- | ------------------------------------------ |
| `hmok_` API key       | Manage orgs, workspaces, channels, webhooks, and channel tokens                               | `https://api.hookmyapp.com`                |
| `hmat_` channel token | Call Meta's Instagram API (DMs, publishing, insights, comments) through one connected channel | `https://gateway.hookmyapp.com/meta/v25.0` |

Fetch the channel token with an `hmok_` API key:

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

Use the returned `hmat_` token to send:

```bash theme={null}
curl -X POST https://gateway.hookmyapp.com/meta/v25.0/{INSTAGRAM_ACCOUNT_ID}/messages \
  -H "Authorization: Bearer hmat_..." \
  -H "Content-Type: application/json" \
  -d '{"recipient":{"id":"17841400000000000"},"message":{"text":"Hello"}}'
```

You can also get the same channel token with `hookmyapp channels env <channel>`.

<Note>
  The version-pinned base URL (`.../meta/v25.0`) 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](/instagram/api/messages/send-message): Send Instagram DMs.
* [Send text guide](/instagram/send-messages/text): Send an Instagram text DM.
* [Receive webhooks](/instagram/receive-webhooks): Handle inbound DMs and read the IGSID.
