# API reference

> The machine contract is [openapi.yaml](/whatsapp/openapi.yaml) (OpenAPI 3.1).

That file is the integrator subset: customers, setup links, branding, hosted and headless Embedded Signup, the phone-number reads and register/check calls, the conversation window, messages, templates, media uploads and stored media copies, webhook config and replay, usage, and billing reads including `GET /billing/rate-card`. It is not generated by a build step. It was written from the Fastify handlers and Zod schemas.

It omits admin routes, contacts, the conversation list, the Meta media proxy (`GET`/`DELETE /media/:id`), calls, groups, conversions, MCP, and phone-number create, patch, delete, business profile, and username routes. Those routes exist in the server. Do not assume a field on them from this file.

Auth is `Authorization: Bearer` except where the operation sets `security: []`. Scopes are in [Authentication](/whatsapp/guides/authentication.md). Error bodies are in [Errors](/whatsapp/api/errors.md). Limits are in [Rate limits](/whatsapp/api/rate-limits.md).

Server URL: `https://wa.vitral.dev`. Paths already include `/api/v1` except `GET /health` and `GET /setup/{token}`.

Successful JSON responses are `{ "data": <payload> }`. Paginated lists add `meta` (`page`, `limit`, `total`, `totalPages`). `POST /api/v1/api-keys` adds `rawKey` next to `data`, returned once. Errors are not wrapped in `data`. `GET /health` is not wrapped. Headless `POST /api/v1/setup/public/{token}/finalize` is not wrapped. `204` responses have no body.

## Operations

| Method | Path | Scope |
| --- | --- | --- |
| `GET` | `/health` | none |
| `GET` | `/api/v1/customers` | `customers:read` |
| `POST` | `/api/v1/customers` | `customers:write` |
| `GET` | `/api/v1/customers/{id}` | `customers:read` |
| `PATCH` | `/api/v1/customers/{id}` | `customers:write` |
| `DELETE` | `/api/v1/customers/{id}` | `customers:write` |
| `GET` | `/api/v1/customers/{customerId}/setup-links` | `setup-links:manage` |
| `POST` | `/api/v1/customers/{customerId}/setup-links` | `setup-links:manage` |
| `GET` | `/api/v1/customers/{customerId}/setup-links/{id}` | `setup-links:manage` |
| `PATCH` | `/api/v1/customers/{customerId}/setup-links/{id}` | `setup-links:manage` |
| `POST` | `/api/v1/customers/{customerId}/setup-links/{id}/regenerate` | `setup-links:manage` |
| `DELETE` | `/api/v1/customers/{customerId}/setup-links/{id}` | `setup-links:manage` |
| `GET` | `/api/v1/branding` | `setup-links:manage` |
| `POST` | `/api/v1/branding` | `setup-links:manage` |
| `GET` | `/api/v1/branding/{id}` | `setup-links:manage` |
| `PATCH` | `/api/v1/branding/{id}` | `setup-links:manage` |
| `DELETE` | `/api/v1/branding/{id}` | `setup-links:manage` |
| `GET` | `/api/v1/setup/public/{token}` | token in the path |
| `POST` | `/api/v1/setup/public/{token}/finalize` | token in the path |
| `GET` | `/api/v1/setup/public/{token}/status` | token in the path |
| `GET` | `/setup/{token}` | token in the path |
| `POST` | `/api/v1/embedded-signup/token-exchange` | `phone_numbers:write` |
| `POST` | `/api/v1/embedded-signup/register` | `phone_numbers:write` |
| `POST` | `/api/v1/embedded-signup/finish-binding` | `phone_numbers:write` |
| `GET` | `/api/v1/phone-numbers` | `phone_numbers:read` |
| `GET` | `/api/v1/phone-numbers/{id}` | `phone_numbers:read` |
| `PATCH` | `/api/v1/phone-numbers/{id}` | `phone_numbers:write` |
| `GET` | `/api/v1/phone-numbers/{id}/status` | `phone_numbers:read` |
| `POST` | `/api/v1/phone-numbers/{id}/register` | `phone_numbers:write` |
| `POST` | `/api/v1/phone-numbers/{id}/check-connection` | `phone_numbers:write` |
| `GET` | `/api/v1/conversations` | `conversations:read` |
| `GET` | `/api/v1/conversations/{id}` | `conversations:read` |
| `POST` | `/api/v1/conversations/{id}/bot-resume` | `conversations:read` (for now) |
| `GET` | `/api/v1/conversations/window` | `conversations:read` |
| `GET` | `/api/v1/messages` | `messages:read` |
| `POST` | `/api/v1/messages` | `messages:send` |
| `POST` | `/api/v1/messages/batch` | `messages:send` |
| `GET` | `/api/v1/messages/{id}` | `messages:read` |
| `POST` | `/api/v1/messages/{id}/mark-read` | `messages:send` |
| `POST` | `/api/v1/messages/{id}/react` | `messages:send` |
| `POST` | `/api/v1/media` | `media:write` |
| `POST` | `/api/v1/media/from-url` | `media:write` |
| `GET` | `/api/v1/media/assets` | `media:read` |
| `GET` | `/api/v1/media/assets/{id}` | `media:read` |
| `GET` | `/api/v1/media/assets/{id}/content` | `media:read` |
| `POST` | `/api/v1/media/assets/{id}/retry` | `media:write` |
| `DELETE` | `/api/v1/media/assets/{id}` | `media:write` |
| `GET` | `/api/v1/templates` | `templates:read` |
| `POST` | `/api/v1/templates` | `templates:write` |
| `POST` | `/api/v1/templates/sync` | `templates:write` |
| `GET` | `/api/v1/templates/{id}` | `templates:read` |
| `PATCH` | `/api/v1/templates/{id}` | `templates:write` |
| `DELETE` | `/api/v1/templates/{id}` | `templates:write` |
| `GET` | `/api/v1/webhook-config` | `webhooks:manage` |
| `PUT` | `/api/v1/webhook-config` | `webhooks:manage` |
| `POST` | `/api/v1/webhook-config/rotate-secret` | `webhooks:manage` |
| `GET` | `/api/v1/webhook-config/deliveries` | `webhooks:manage` |
| `POST` | `/api/v1/webhook-config/test` | `webhooks:manage` |
| `POST` | `/api/v1/webhook-config/deliveries/{id}/replay` | `webhooks:manage` |
| `POST` | `/api/v1/webhook-config/deliveries/replay` | `webhooks:manage` |
| `GET` | `/api/v1/api-keys` | `api_keys:read` or `api_keys:manage` |
| `POST` | `/api/v1/api-keys` | `api_keys:manage` |
| `DELETE` | `/api/v1/api-keys/{id}` | `api_keys:manage` |
| `POST` | `/api/v1/webhooks/meta` | Meta signature. No API key. Bad signatures are not stored. |
| `GET` | `/api/v1/usage` | `usage:read` |
| `GET` | `/api/v1/usage/daily` | `usage:read` |
| `GET` | `/api/v1/usage/by-phone-number` | `usage:read` |
| `GET` | `/api/v1/usage/media` | `usage:read` |
| `GET` | `/api/v1/billing/rate-card` | `billing:read` |

Response bodies for `Message`, `PhoneNumber`, and `Template` are the stored rows. The spec lists the fields integrators branch on. Extra columns can appear.
