WhatsApp API authentication
Every WhatsApp API call carries a workspace API key in the Authorization header. The key decides which workspace you reach, who you act as and what you may do.
Send the key#
Put the key in the Authorization header of every request.
Authorization: Bearer sk_live_your_key_hereKeys go in the header only
A key passed in the URL query string is refused, so it never ends up in server logs or browser history.
One key, one workspace#
- A key works only inside the workspace it was made in.
- It is the same workspace API key the MCP server uses. One key can serve both, and they share its request budget.
- The REST API is included in API Growth and API Ultra, and during the trial, the same as the MCP server.
A key acts as a person#
Every key belongs to one member of the workspace and acts with that member's role. It can never do more than they can in SheetWA. When an action needs an owner or admin and the key belongs to a member, the answer is 403 FORBIDDEN.
If that person leaves the workspace, the key stops working.
Permissions#
Each endpoint needs one permission: <area>:view to read, or <area>:change to create, change, send or delete. A key has every permission unless whoever made it picked View and Change per area under Advanced access.
contacts:view
Endpoints: GET /v1/contacts, POST /v1/contacts/lookup, GET /v1/contacts/{contact_id}, GET /v1/tags, GET /v1/contact-attributes
contacts:change
Endpoints: POST /v1/contacts, POST /v1/contacts/bulk, PATCH /v1/contacts/{contact_id}, DELETE /v1/contacts/{contact_id}, POST /v1/contacts/{contact_id}/unsubscribe, POST /v1/tags, POST /v1/tags/assign, POST /v1/tags/unassign, PATCH /v1/tags/{tag_id}, DELETE /v1/tags/{tag_id}, POST /v1/contact-attributes, PATCH /v1/contact-attributes/{attribute_id}, DELETE /v1/contact-attributes/{attribute_id}
templates:view
Endpoints: GET /v1/templates, GET /v1/templates/{template_name}/{language_code}, GET /v1/template-drafts, GET /v1/template-library
templates:change
Endpoints: POST /v1/templates/submit, POST /v1/template-drafts
messages:view
Endpoints: GET /v1/messages/{message_id}
messages:change
Endpoints: POST /v1/messages
inbox:view
Endpoints: GET /v1/messages, GET /v1/inbox/counts, GET /v1/chats, GET /v1/chats/{chat_id}, GET /v1/chats/{chat_id}/messages
inbox:change
Endpoints: PATCH /v1/chats/{chat_id}, POST /v1/chats/{chat_id}/reply, POST /v1/chats/{chat_id}/reply-template
broadcasts:view
Endpoints: GET /v1/errors/{code}, GET /v1/broadcasts, GET /v1/broadcasts/best-send-time, GET /v1/broadcasts/{broadcast_id}, GET /v1/broadcasts/{broadcast_id}/stats, GET /v1/broadcasts/{broadcast_id}/recipients, GET /v1/broadcasts/{broadcast_id}/failures
broadcasts:change
Endpoints: POST /v1/broadcasts, POST /v1/broadcasts/{broadcast_id}/pause, POST /v1/broadcasts/{broadcast_id}/resume, POST /v1/broadcasts/{broadcast_id}/cancel, POST /v1/broadcasts/{broadcast_id}/retry, PATCH /v1/broadcasts/{broadcast_id}/retry, DELETE /v1/broadcasts/{broadcast_id}/retry
notes:view
Endpoints: GET /v1/notes
notes:change
Endpoints: POST /v1/notes, DELETE /v1/notes/{note_id}
auto_replies:view
Endpoints: GET /v1/auto-replies
auto_replies:change
Endpoints: POST /v1/auto-replies, PATCH /v1/auto-replies/{auto_reply_id}, DELETE /v1/auto-replies/{auto_reply_id}
quick_replies:change
Endpoints: POST /v1/quick-replies, PATCH /v1/quick-replies/{quick_reply_id}, DELETE /v1/quick-replies/{quick_reply_id}
any key
Endpoints: GET /v1/connection, GET /v1/members, GET /v1/media, GET /v1/quick-replies
| Permission | Endpoints |
|---|---|
| contacts:view | GET /v1/contacts, POST /v1/contacts/lookup, GET /v1/contacts/{contact_id}, GET /v1/tags, GET /v1/contact-attributes |
| contacts:change | POST /v1/contacts, POST /v1/contacts/bulk, PATCH /v1/contacts/{contact_id}, DELETE /v1/contacts/{contact_id}, POST /v1/contacts/{contact_id}/unsubscribe, POST /v1/tags, POST /v1/tags/assign, POST /v1/tags/unassign, PATCH /v1/tags/{tag_id}, DELETE /v1/tags/{tag_id}, POST /v1/contact-attributes, PATCH /v1/contact-attributes/{attribute_id}, DELETE /v1/contact-attributes/{attribute_id} |
| templates:view | GET /v1/templates, GET /v1/templates/{template_name}/{language_code}, GET /v1/template-drafts, GET /v1/template-library |
| templates:change | POST /v1/templates/submit, POST /v1/template-drafts |
| messages:view | GET /v1/messages/{message_id} |
| messages:change | POST /v1/messages |
| inbox:view | GET /v1/messages, GET /v1/inbox/counts, GET /v1/chats, GET /v1/chats/{chat_id}, GET /v1/chats/{chat_id}/messages |
| inbox:change | PATCH /v1/chats/{chat_id}, POST /v1/chats/{chat_id}/reply, POST /v1/chats/{chat_id}/reply-template |
| broadcasts:view | GET /v1/errors/{code}, GET /v1/broadcasts, GET /v1/broadcasts/best-send-time, GET /v1/broadcasts/{broadcast_id}, GET /v1/broadcasts/{broadcast_id}/stats, GET /v1/broadcasts/{broadcast_id}/recipients, GET /v1/broadcasts/{broadcast_id}/failures |
| broadcasts:change | POST /v1/broadcasts, POST /v1/broadcasts/{broadcast_id}/pause, POST /v1/broadcasts/{broadcast_id}/resume, POST /v1/broadcasts/{broadcast_id}/cancel, POST /v1/broadcasts/{broadcast_id}/retry, PATCH /v1/broadcasts/{broadcast_id}/retry, DELETE /v1/broadcasts/{broadcast_id}/retry |
| notes:view | GET /v1/notes |
| notes:change | POST /v1/notes, DELETE /v1/notes/{note_id} |
| auto_replies:view | GET /v1/auto-replies |
| auto_replies:change | POST /v1/auto-replies, PATCH /v1/auto-replies/{auto_reply_id}, DELETE /v1/auto-replies/{auto_reply_id} |
| quick_replies:change | POST /v1/quick-replies, PATCH /v1/quick-replies/{quick_reply_id}, DELETE /v1/quick-replies/{quick_reply_id} |
| any key | GET /v1/connection, GET /v1/members, GET /v1/media, GET /v1/quick-replies |
Each endpoint in the reference shows the permission it needs.
Keep keys on your server#
Call the API from your server or a background job, never from a web page. A browser adds an Origin header to the requests your pages send, and the API refuses those. A key in front-end code would also be visible to every visitor.
Rotate a key#
- 1
Create a new key
On the API keys page, make a new key for the same person.
- 2
Swap it in
Put the new key on your server and check that calls succeed with it.
- 3
Revoke the old key
Revoke the old key on the API keys page. It stops working on the next request.
If a key leaks#
- 1
Revoke it now
Revoke the key on the API keys page. It stops working on the next request.
- 2
Make a new key
Create a new key and put it on your server.
- 3
Check what happened
Look through recent messages, broadcasts and contacts in the dashboard for anything you did not do.
- 4
Clean up
Remove the key from wherever it leaked, such as a repository's history or a shared file. If your webhook signing secret was exposed too, roll it.