Skip to navigation

Send a one-time code

Sends a one-time code to an email address or phone number and returns the challenge, with what is known about the contact. Codes are valid for five minutes.

Sandbox. On sandbox and development keys nothing is sent. The code is all zeros at the length you asked for (000000 by default) and deliveryChannel is test.

Billing. Nothing is charged for sending. The check is charged when a code is accepted, in production only. In production the send is refused with 402 when your balance cannot cover that charge; the response then also carries required and balance as decimal strings.

Limits. Five codes per destination per hour, and an hourly ceiling per organisation across all destinations.

Countries. Phone codes currently go to Nigerian numbers (+234) only. Other countries are refused with 422 phone_country_not_supported before anything is priced or sent. Email codes work for every country.

Error codes

errorStatusMeaning
invalid_request400The body failed validation. message says what.
invalid_destination400The phone number could not be parsed (send country for national formats), or, in production where email risk scoring is on, the email domain publishes no mail server and could never receive the code. With corporateOnly, an address at a personal email service is refused too, with reason corporate_email_required.
insufficient_credits402Your balance cannot cover the check.
secret_key_required403A publishable key was used. This endpoint accepts secret keys only.
environment_mismatch403The key belongs to an environment this deployment does not serve.
ip_not_allowed403The key has an IP allowlist and the calling address is not on it.
organization_suspended403The organisation is suspended. The response carries reason and suspendedAt.
business_not_approved403A live key was used before the business was approved for production.
verifications_disabled403Every verification is switched off for the organisation. Nothing is sent or charged.
organization_not_found404The organisation behind the key no longer exists.
phone_country_not_supported422We cannot text a code to numbers in this country yet (today Nigerian numbers, +234, only). Refused before pricing; nothing is sent or charged and it does not count towards the hourly code limits. message can be shown to the person.
send_rate_limited429A send limit was reached.
pricing_not_configured500No price is configured for this check. Contact support.
send_failed502The message could not be handed to its delivery channel. Nothing was charged.

A missing or unknown key answers 401, where error is a short sentence rather than a code.

Requires a secret (sk_) key. A publishable key receives 403 secret_key_required.

Authentication

AuthorizationBearer

Send the API key as a Bearer token. Each operation states whether a publishable key is enough or a secret key is required. A scoped publishable key has Verification flow access, the fixed set flow.run, flow.config.read and verifications.status.read; a scoped secret key reaches what its scopes allow.

Request

This endpoint expects an object.
channelenumRequired
What to verify.
Allowed values:
destinationstringRequired3-254 characters

The email address or phone number. A phone number in national format is resolved against country.

countrystringOptional=2 characters

ISO 3166-1 alpha-2. Resolves national phone formats and selects the price. It is stored and reused when the check is charged.

viaenumOptional

The preferred phone delivery. whatsapp is accepted and currently delivers by SMS.

Allowed values:
codeLengthintegerOptional1-20
Digits in the code. Values are brought into the range 4 to 8. Defaults to 6.
maxAttemptsintegerOptional1-20
Wrong codes allowed. Values are brought into the range 1 to 5. Defaults to 3.
alphanumericCodebooleanOptional

Send a code of capital letters and digits (no 0, O, 1, I or L) instead of digits only. It is checked case-insensitively. Outside production the code is still all zeros.

maxSendsintegerOptional1-20

Codes one address may be sent per hour. Values are brought into the range 1 to 5. Defaults to 3. Past it the send answers send_rate_limited.

corporateOnlybooleanOptional

Email: refuse an address at a personal email service such as Gmail or Outlook before a code is sent. The refusal is invalid_destination with reason corporate_email_required.

externalUserIdstringOptional1-190 characters
Your own reference for the person. A verified contact is recorded against their existing record. No record is created.

Response

The code was sent.
contactVerificationobject

Errors

400
Bad Request Error
401
Unauthorized Error
402
Payment Required Error
403
Forbidden Error
404
Not Found Error
422
Unprocessable Entity Error
429
Too Many Requests Error
500
Internal Server Error
502
Bad Gateway Error