Concepts

Sessions and statuses

A session is one WhatsApp number linked to your account. Everything else in the API happens inside a session, so you create one first, link a number to it, and keep it ready.

Tusk WhatsApp API: Sessions and statuses

What does a session look like?

Session object
{
  "id": "9c1f6a4e-2b7d-4e0a-8f53-6d2a1b7c9e10",
  "name": "Sales",
  "phone": "254700000001",
  "status": "ready",
  "status_label": "Ready",
  "active": true,
  "created_at": "2026-01-15T09:30:00Z"
}
NameTypeDescription
idstringThe session id. Use it as sessionId in paths.
namestringThe label you gave the session, up to 80 characters.
phonestring | nullThe linked number, or null until a number is linked.
statusstringMachine-readable status. See the table below.
status_labelstringHuman-readable status for display.
activebooleanWhether the session is currently connected and usable.
created_atstringISO 8601 creation time in UTC.

Which statuses can a session have?

statusMeaning
createdThe session exists but has not been started.
initializingThe session is starting up.
qr_readyA QR code is available. Scan it, or request a pairing code instead.
authenticatingThe number is being linked.
readyLinked and connected. You can send and receive messages.
disconnectedThe connection dropped. Start the session again.
action_requiredThe session needs attention before it can be used. Check the dashboard, and if it does not clear, log out and link the number again.
failedThe session could not start. Try force-kill and start again, and if it keeps failing, log out and link the number again.

Send messages only while the status is ready. Subscribe to the session.status webhook event to react to changes without polling.

How do I link a number?

After POST /sessions/{sessionId}/start, the session reaches qr_ready. Link it in one of two ways:

  • QR code. GET /sessions/{sessionId}/qr returns the code to scan from WhatsApp, under Linked devices.
  • Pairing code. POST /sessions/{sessionId}/pairing-code with the phone number returns an 8-character code you enter on the phone, under Linked devices, then Link with phone number. Handy when you cannot scan a screen.
curl -X POST "https://api.tuskmail.africa/v1/whatsapp/sessions/$SESSION_ID/pairing-code" \
  -H "X-API-Key: $TUSK_WA_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "phoneNumber": "254700000001"
}'

How do I manage a session over time?

start
Starts a stopped or new session. A previously linked number reconnects without a new QR code.
stop
Disconnects the session but keeps the linked number.
logout
Unlinks the number. You need to link again to use the session.
force-kill
Terminates a stuck session. Start it again afterwards.
DELETE
Deletes the session and frees a slot on your plan.

The number of sessions you can create depends on your plan. See plan and limits.