Skip to content
Tellwing

Verifications

Send verification codes with fallback and check them with the Tellwing API: WhatsApp when your WhatsApp account has an approved authentication template, then SMS and email.
Create a free account

Base URL https://api.tellwing.com/v1 · version 1.0.0

Endpoints

post/verificationsScope: verifications:send

Send a verification code with automatic fallback

Tellwing generates a one-time code and sends it through the first channel that can deliver it, in order: **WhatsApp** (your approved authentication template, from your number), then **SMS**, then **email** (when you send `email`). If the code is not delivered within `fallback_after` seconds, or the channel fails, Tellwing sends a new code through the next channel; any code sent stays valid until `expires_at`. Then call `POST /verifications/{id}/check` with what the person typed. WhatsApp joins the cascade when your WhatsApp account has an approved authentication template (Settings → API → Verifications); until then it is skipped without an error and the cascade starts with SMS. A channel that cannot send (not in your plan, no balance, a country not open for SMS, an opted out number) is skipped and listed in `attempts` with its `reason`. If no channel can send, `409 channel_not_available` and nothing was sent. **Cost:** each verification costs only the messages actually sent: WhatsApp bills its message to your WhatsApp account, an SMS is paid at its country rate from your SMS quota or balance, and an email counts against your email quota; no extra fee. **Fraud controls**, all checked before sending: numbers in high cost or high fraud countries are refused, and there are limits per number and per email address (per hour and per day), per organization and per country, plus detection of many consecutive numbers (SMS pumping) (`429 rate_limited`). The code and the destination never appear in responses or webhooks; the destination is deleted when the verification ends. Live keys need a plan with API access (Growth or higher), as `POST /sms` and `POST /whatsapp`.

Accepts Idempotency-Key.

Request body (application/json)

FieldTypeRequiredDescription
tostringOptionalThe phone number, E.164 (+573001234567) or national of your organization's country. For WhatsApp and SMS. Send to, email or both.
emailstring (email)OptionalThe email address, for the email channel (last in the default order).
channels"whatsapp" | "sms" | "email"[]OptionalThe channels to try, in order. Default: whatsapp, sms, email, keeping those whose destination you sent.
locale"es" | "en" | "pt"OptionalLanguage of the SMS and the email (and the preferred WhatsApp template language). Default es.
code_lengthintegerOptionalDigits of the code. Default 6.
expires_inintegerOptionalSeconds the codes stay valid. Default 600.
fallback_afterintegerOptionalSeconds to wait for a channel to deliver before trying the next one. Default 45.
max_attemptsintegerOptionalWrong codes allowed before the verification fails. Default 5.
brandstringOptionalThe name shown in the SMS and the email, without links. Default: your organization's name.

Responses

  • 201The code went out through a channel. The fallback, if needed, happens on its own.
  • 400`invalid_request`: `param` names the field (`to`, `email`, `channels`, `locale`, `code_length`, `expires_in`, `fallback_after`, `max_attempts`, `brand`); also `to` in a country Tellwing does not send codes to (high cost or fraud risk). Nothing was sent.
  • 403`sending_paused`: sending is paused for your organization (while Tellwing reviews its activity, because of its bounce or complaint rate, or until updated legal documents are accepted), nothing was sent; `forbidden_scope`: the key lacks `verifications:send`.
  • 409`channel_not_available`: no channel could send the code (the message lists each channel and why). Nothing was sent.
  • 429`rate_limited`: too many verifications to that number or address in the last hour or day, for your organization, to that country today, to consecutive numbers (SMS pumping), or too many requests. Nothing was sent.
curl -X POST "https://api.tellwing.com/v1/verifications" \
-H "Authorization: Bearer tw_live_…" \
-H "Idempotency-Key: $(uuidgen)"
get/verifications/{id}Scope: verifications:send

Get a verification

The status of a verification and every channel tried: `sent`, `delivered`, `failed`, `undelivered` (not delivered in time, so the next channel was tried) or `skipped` (with `reason`). Never the code or the destination.

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)Required

Responses

  • 200The verification.
  • 404`not_found`: no verification with that id in your organization.
curl -X GET "https://api.tellwing.com/v1/verifications/8c1f2b3e-4d5a-4f60-9b7c-2e1d3c4b5a69" \
-H "Authorization: Bearer tw_live_…"
post/verifications/{id}/checkScope: verifications:send

Check a verification code

Compares the code the person typed. `result` is `approved` (`valid: true`; the verification is closed and no code works again), `rejected` (wrong code; `attempts_remaining` says how many are left), `expired`, `max_attempts_reached` or `already_used` (it was approved before: a code works once). Any code sent by any channel of this verification is accepted. A request with a code that is not 4 to 10 digits is `400` and does not count as an attempt.

Accepts Idempotency-Key.

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)Required

Request body (application/json)

FieldTypeRequiredDescription
codestringRequiredThe digits the person typed.

Responses

  • 200The result of the check.
  • 400`invalid_request`: `code` is not 4 to 10 digits (`param: code`). It does not count as an attempt.
  • 404`not_found`: no verification with that id in your organization.
curl -X POST "https://api.tellwing.com/v1/verifications/8c1f2b3e-4d5a-4f60-9b7c-2e1d3c4b5a69/check" \
-H "Authorization: Bearer tw_live_…" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"code": "482913"
}'