Skip to Content
WhatsApp API by Retention Stack

Sessions

Create, link, and manage WhatsApp sessions.

A session is one linked WhatsApp number. Its status tells you what to do next. Check it with GET /v1/sessions/SESSION_NAME.

The examples below use an account key and the session name. With a session token, use me in place of the name, as in /v1/me/auth/qr.

StatusMeaningNext step
STARTINGBootingWait a few seconds
SCAN_QR_CODEWaiting to be linkedShow the QR code or request a pairing code
PASSKEY_REQUIREDWhatsApp wants a passkeyPasskey linking
PASSKEY_CONFIRMATION_REQUIREDCompare a 4-digit codePasskey linking
WORKINGLinked and readySend messages
STOPPED / FAILEDNot runningPOST /v1/sessions/start with {"name": "SESSION_NAME"}

Create a session from code

Creating a session needs your account key. A session token returns 403.

curl -X POST https://wp-rapidapi.retentionstack.agency/v1/sessions \
  -H "Authorization: Bearer ak_live_YOUR_ACCOUNT_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

The body is empty. The server picks the name, and a name you send is ignored. The response is 201:

{
  "success": true,
  "data": {
    "name": "session_inhouse_b5ec3f1478d1_1794337927859_um5zhm",
    "status": "STARTING",
    "channel_token": "ch_live_...",
    "billing_status": "trial",
    "trial_ends_at": null
  }
}

Save two values:

  • name: use it as SESSION_NAME with your account key.
  • channel_token: the new session's own token. Use it to send from this number without naming the session.

Then link the phone with a QR code or a pairing code.

How many sessions you can create

Your account can hold a limited number of unpaid sessions at once (current numbers are on the pricing page). When you reach it, POST /v1/sessions returns 403 with maxConcurrentTrialChannels and activeTrialCount in error.details.

Paid sessions do not count toward that limit. To add more numbers, upgrade an existing session in the console or delete one you no longer use, then create the next one. Upgrading is done in the console; there is no API for payment.

curl "https://wp-rapidapi.retentionstack.agency/v1/SESSION_NAME/auth/qr?format=binary" \
  -H "Authorization: Bearer ak_live_YOUR_ACCOUNT_KEY" -o qr.png

Without format=binary the response is JSON with the image as base64 in data.data. Stopped or failed sessions are restarted automatically before the QR is fetched.

No camera needed. Send the number with country code, digits only:

curl -X POST https://wp-rapidapi.retentionstack.agency/v1/SESSION_NAME/auth/pairing-code \
  -H "Authorization: Bearer ak_live_YOUR_ACCOUNT_KEY" -H "Content-Type: application/json" \
  -d '{"phoneNumber": "15551234567"}'

Enter the returned code on the phone: WhatsApp → Settings → Linked devices → Link a device → Link with phone number instead. The code expires after about 60 seconds.

Stay under the radar

Linked numbers behave like a real WhatsApp client. Space out bursts and avoid messaging people who have not opted in, or WhatsApp may log the session out.

Was this page helpful?

On this page