Skip to main content

Get the WhatsApp activation code

WhatsApp verifies a landline by calling it and speaking a 6-digit code. These endpoints capture that call for you: you open a capture window on the line, ask WhatsApp to call, and read the code — transcribed from the call — from the API.
Requires a tenant-scoped key. With an OAuth / MCP token, the user must be an Owner or Admin (phone_lines:read) — 403 PERMISSION_DENIED otherwise. Every response that carries an activation is sent with Cache-Control: no-store (the recording with private, no-store): the code is a credential — whoever holds it can register a WhatsApp account on the line, and the recording speaks it.

How it works

1

Open a request — before WhatsApp calls

POST /v1/phone-lines/{id}/activations. The line is reset at the carrier, so the recording of an earlier call can never be read as this one’s code, and a request opens in WAITING until pollDeadline — 5 minutes later. A call that arrives before this request exists is not captured.
2

Ask WhatsApp to call the line

Register the number in WhatsApp Business and, when asked how to receive the code, choose the phone call option (“Call me”). The line is a landline and does not receive SMS — waiting for an SMS only burns the window.
3

We capture and transcribe

We check the line about every 15 seconds while the window is open, and once more right after it closes. When a recording appears we store it (CAPTURED), transcribe it and extract the code (TRANSCRIBED). A failed transcription is retried from the stored recording — up to 3 attempts in all — so reading the code usually takes seconds, but can take a few minutes.
4

Read the code

Poll GET /v1/phone-lines/activations/{activationId} every few seconds — or listen for the phone_line.code_received webhook — and type code into WhatsApp.

Request a code

POST https://pilotstatus.com.br/v1/phone-lines/{id}/activations — no body. Answers 201 with the new request.
  • Allowed while the line is ACTIVE or PAYMENT_PENDING (including an ACTIVE line cancelled at period end). A SUSPENDED, RETURNED or CANCELED line gets 409 LINE_NOT_ACTIVE.
  • One waiting request per line. While a request is WAITING and its pollDeadline is still ahead, another POST answers 409 ACTIVATION_IN_PROGRESS — poll the one you have instead, or cancel it to ask again right away.
  • No limit on requests over time. Ask again whenever you need to (re-registering WhatsApp, a window that timed out); each request that opens increments the line’s activationCount.

Poll the request

GET https://pilotstatus.com.br/v1/phone-lines/activations/{activationId} returns { "activation": { … } }. A request of another workspace answers 404 ACTIVATION_NOT_FOUND, the same as one that does not exist.
Polling every few seconds is plenty: the status can only move after our next 15-second check of the line.

Statuses

Do not stop polling at the first status that is not WAITING. CAPTURED is also the in-between state while the code is being read: keep polling while status is WAITING, or CAPTURED with failureReason: null. And TRANSCRIBED does not guarantee a code — check code. Reading the code usually takes seconds, but a failed transcription is retried from the stored recording — up to 3 attempts in all — so a request can stay CAPTURED with failureReason: null for a few minutes. It then ends with the code (TRANSCRIBED) or with transcription_failed.
  • TIMED_OUT is recorded at the first check after pollDeadline, so it can show up to about 15 seconds after the deadline. That check still reads the line one last time: a call that lands in the window’s last seconds is captured, not lost — so a request can also move from WAITING to CAPTURED just after its pollDeadline. If a request still reads WAITING well after its pollDeadline, treat it as timed out: a new POST is already allowed, because the one-at-a-time rule only counts requests whose pollDeadline is still ahead.
  • failureReason is always one of the fixed values in the table (no_call_in_window, canceled_by_customer, no_code_in_transcript, transcription_failed, audio_download_failed, audio_store_failed, poll_not_scheduled) or null. You can branch on it; treat an unknown value as a failure, since new ones may be added.
  • The code comes from speech-to-text. WhatsApp speaks the code during the call; we transcribe the recording and keep the 6-digit sequence heard most often. If WhatsApp rejects the code, listen to the recording.
  • The recording is served on its own. hasAudio: true tells you there is one: download it from GET /v1/phone-lines/activations/{activationId}/audio, or play it in the dashboard (Phone lines → the line). The raw transcription is never returned.

Download the recording

GET https://pilotstatus.com.br/v1/phone-lines/activations/{activationId}/audio returns the call recording of a request whose hasAudio is true — the stored file itself, not JSON.
  • Same credentials as polling: a tenant-scoped key, or an OAuth / MCP token of an Owner or Admin (phone_lines:read).
  • Headers: Content-Type is the recording’s own format — usually audio/wav or audio/mpeg, since the carrier’s format varies from call to call — with its Content-Length. Content-Disposition: attachment; filename="activation-{activationId}.wav" (.mp3 for an MP3; no extension for any other format). Cache-Control: private, no-store: the recording speaks the activation code.
  • 404 ACTIVATION_NOT_FOUND answers, all alike: a request of another workspace or an unknown id; a request without a recording (hasAudio: false — the wait timed out or was cancelled before any call, or the call could not be downloaded or stored); and any request of a line that is RETURNED or CANCELED — a line that leaves your workspace has its recordings deleted.
  • You rarely need to build this URL. The phone_line.audio_received, phone_line.code_received and phone_line.code_failed webhooks carry it as audioUrl whenever the request has a recording. The URL holds no credential — send your key with it.

Cancel a wait

POST https://pilotstatus.com.br/v1/phone-lines/{id}/activations/{activationId}/cancel — no body. Ends a request that is still WAITING, so the next POST /v1/phone-lines/{id}/activations is accepted at once instead of answering 409 ACTIVATION_IN_PROGRESS until the window closes. Same credentials and permission as the other activation endpoints (phone_lines:read). Answers 200 with { "activation": { … } }, now TIMED_OUT with failureReason: "canceled_by_customer", sent with Cache-Control: no-store. The line is no longer watched for that request. Like any request that ends without a code, it sends phone_line.code_failed and phone_line.code_received (with code: null) once, with canceled_by_customer — so an integration waiting on the webhook learns about a wait cancelled from the dashboard, too.
  • A call that already arrived is never thrown away. Once the call is captured the request is no longer WAITING, and the cancel answers 409 ACTIVATION_NOT_WAITING — keep polling: its code is being read. The same 409 answers a request that already ended. Nothing changes in either case.
  • {id} must be the line the request belongs to. A line that is not in your workspace answers 404 LINE_NOT_FOUND; a request that is not on that line — or not in your workspace — answers 404 ACTIVATION_NOT_FOUND.

Code history

GET https://pilotstatus.com.br/v1/phone-lines/{id}/activations returns the line’s requests, newest first, codes included: { "activations": [ … ] }. It works on suspended lines too — they keep their history. A line that left your workspace — RETURNED or CANCELED — has its history deleted: its requests are still listed (id, status, timestamps, failureReason) and its activationCount is kept, but code is null, hasAudio turns false as the recordings are deleted, and downloading a recording answers 404.
integer
default:"20"
1 to 100. Anything else (0, 101, a decimal, text, empty) → 400 INVALID_LIMIT.
A line of another workspace answers 404 LINE_NOT_FOUND — never an empty list.

Activation object fields

string
The request id (activationId).
string
The line the request belongs to.
string
WAITING, CAPTURED, TRANSCRIBED, TIMED_OUT or FAILED — see Statuses.
string
ISO 8601 — when the request was opened.
string
ISO 8601 — end of the capture window, 5 minutes after the request.
string | null
The 6-digit code, once TRANSCRIBED and found. null otherwise.
string | null
ISO 8601 — when the call recording was stored.
string | null
ISO 8601 — when the transcription finished.
string | null
Why a final request has no code — see Statuses.
boolean
Whether a recording of the call is stored — downloadable from GET /v1/phone-lines/activations/{activationId}/audio and playable in the dashboard.

Errors