Get started
Partner API: provision workspaces for your customers
A partner account (for example a product that embeds WhatsApp for its own customers) provisions one workspace per customer with a pk_partner_ key. Each call returns the workspace’s own API key and webhook secret. Partner workspaces are covered by the partner: no trial, no paywall. Partner accounts are created by whatsappx.si staff.
The partner key
- Sent as
Authorization: Bearer pk_partner_…(pk_partner_, 32 letters and digits,_and a 6-character checksum, like workspace keys). Only a SHA-256 hash is stored, the key is shown once, and leaked-key scanning recognises it. - It can call
/api/v1/partner/*and nothing else: it cannot read inboxes or send messages. Use the workspace’s own key (returned on create) for that. - A normal
pk_live_key on a partner endpoint is403not_partner_key. A missing, wrong or revoked partner key is401unauthorized. Outside the key’s IP allowlist (if staff set one) it is403ip_not_allowed. - Limit: 30 requests per minute per partner, then
429rate_limitedwith aRetry-Afterheader. - Staff set your workspace quota. Over it, creating a new workspace is
409limit_reached. - Every call is written to the audit log (partner, endpoint, workspace, external id, IP, time). Keys and secrets are never logged.
Errors have the usual shape {"error": "…", "code": "…"}: 400 invalid_request, 401 unauthorized, 403 not_partner_key, 404 not_found, 409 limit_reached, 429 rate_limited. A workspace of another partner is 404, never 403.
Create a workspace
POST /api/v1/partner/workspaces
| Field | |
|---|---|
external_id | Required, at most 255 characters, unique per partner. Your id for the customer. |
webhook_url | Required, https only. Private, loopback and link-local addresses are refused. |
name | Optional, at most 120 characters. |
timezone, locale | Optional, an IANA name such as Asia/Kolkata and a tag such as en-IN. |
In one transaction this creates the workspace, one API key (scope write, never expires, named after your partner account) and one webhook (events messages) with a new signing secret:
{
"workspace_id": "6f1c2a52-…",
"external_id": "cust-1",
"api_key": "pk_live_…",
"webhook_id": "0b7e…",
"webhook_secret": "whsec_…",
"created": true
}
Status 201. Calling it again with the same external_id is safe to retry: it returns 200 with the same workspace_id, "created": false, a new api_key (the old one is revoked) and a new webhook_secret; if webhook_url changed, the webhook is updated. It never creates a second workspace.
Connect WhatsApp
POST /api/v1/partner/workspaces/{id}/connect (no body) starts the same connection as the console. The answer is {"connected": false, "logged_in": false, "qr_pending": true}; then fetch the code with GET /api/whatsapp/qr using the workspace’s api_key (no sign-in needed) and show it to your customer. A workspace that is already linked reconnects and answers "logged_in": true with its jid.
Get a workspace
GET /api/v1/partner/workspaces/{id} returns workspace_id, external_id, name, logged_in, connected, qr_pending, jid and created_at. It never returns a key or secret.
Disconnect
POST /api/v1/partner/workspaces/{id}/disconnect unlinks the WhatsApp session (the console’s “Unlink”) and keeps the workspace, key and webhook. Answer: {"logged_in": false}.
Delete
DELETE /api/v1/partner/workspaces/{id} unlinks WhatsApp, revokes the key at once, deletes the webhook (deliveries stop) and closes the workspace; its data is then erased. Answer 204, also when it was already deleted. The external_id can be used again afterwards.
Webhook payloads and signatures are described in Webhooks.