Connect WhatsApp
Start a QR session
Starts the QR-linked session for the workspace. If the number is not linked yet, a QR code becomes available from GET /api/whatsapp/qr. If it is already linked, the session reconnects. Returns the session state. Linking a device is channel administration, so only owners and admins signed in to the app can call it; API keys get 403.
- Console only: owner or admin
- Workspace:
X-Tenant-ID
Headers
CookiestringrequiredThe
whatsappx_sessioncookie the app sets when you sign in. Browsers send it automatically; API keys are not accepted on this endpoint.X-Tenant-IDuuidrequiredWorkspace id. Required for session requests. You can pass
?tenant=<id>instead.
Response
200 OKapplication/json
connectedbooleanThe linked session is connected to WhatsApp.
logged_inbooleanThe number is linked (paired) to this workspace.
qr_pendingbooleanA QR code is waiting to be scanned.
jidstringmay be absentWhatsApp id of the linked number, once linked.
Status codes
- 200OK. The session state after starting.
- 401Unauthorized. No signed-in session (
unauthorized). - 402Payment required. Only when subscriptions are enforced and the workspace has no active subscription. The body includes
code: "payment_required". - 403Forbidden. API keys can never call this endpoint (
API keys cannot administer workspaces). A signed-in user who is not an owner or admin getsadmin required; a user who is not a member of the workspace getsforbidden. - 500Server error. The session could not be started. The
errorcarries the reason.
How is a number linked?
Start the session
An owner or admin clicks Connect in the app (this calls
POST /api/whatsapp/connectwith their session).Show the QR code
The app shows it. With an API key you can also poll
GET /api/whatsapp/qrevery few seconds and displayimagewhilependingistrue.Scan it
On the phone: WhatsApp → Settings → Linked devices → Link a device.
Wait for the link
Poll
GET /api/whatsapp/statusuntillogged_inandconnectedaretrue. Chats then sync in the background; the live event stream reportssync.progress.