Skip to main content

Automate SMS OTPs With Programmable Identity Verification

Didit automates SMS OTPs with two endpoints: send a code by SMS, WhatsApp, Telegram or voice, then check it and get carrier, disposable and VoIP risk signals.

Automate SMS OTPs With Programmable Identity Verification

Contents

In this guide

Jump to the part you need.

SMS OTP automation fits teams that already send one-time codes and want delivery, validation and number risk signals handled by one API instead of a home-built sender. With Didit, phone verification costs from $0.02 plus the carrier price for the country and channel, billed per code. The caveat is scope: an OTP proves control of a number, not identity, so pair it with a document and a liveness check.

Last updated: November 26, 2026. Prices checked against the live Didit price feed on November 26, 2026.

SMS OTP automation with Didit at a glance
ItemDetail
OutcomeA code generated, delivered, checked and scored, with the result returned to your app
EndpointsPOST /v3/phone/send/ then POST /v3/phone/check/
ChannelsSMS, WhatsApp, Telegram, voice call, Viber
Price per codeCarrier price for the country and channel plus a $0.02 Didit fee. US SMS $0.0473, UK SMS $0.0783, Germany SMS $0.1145 at list price
Code window5 minutes from the first send; a retry inside the same window keeps the deadline
Wrong-code limit5 attempts per standalone verification by default
Risk signalsCarrier, line type, disposable, virtual, ported, plus the PHONE warning codes
PlansFree plan credit does not cover phone codes; a paid Growth or Scale plan or one top-up is required before the first live code
SandboxSandbox testing is free and unlimited

Start free in the sandbox at business.didit.me, no sales call. For developers, connect Didit to an AI assistant through the MCP server. Every module price sits on the pricing page, and the per-country code list is on the phone price page.

What changes when the OTP step is automated

A manual OTP process means writing and maintaining the code generation, delivery, attempt counting and expiry logic yourself, then judging separately whether the number looks real. Automation moves all of that into one call pair, and the answer comes back with the number's metadata attached. That metadata is the part most home-built flows miss. A code can be delivered to a virtual number and still return Approved, so the risk fields decide what you do next.

We recommend the standalone API pair when you already own the OTP screen and want to keep your own UI. Use the session workflow instead when you want Didit to run the screen, collect the number, count attempts, and continue into a document check. Both routes return the same status values, so you can start standalone and move into a workflow later without rewriting your result handling. The Phone Verification API docs list the send, check, retry and next-channel routes, and the pricing page carries every unit price.

Prerequisites

  • A Didit organization and an application. Sandbox testing is free and unlimited.
  • An API key from Developers then API keys in the Business Console. Send it in the x-api-key header, server side only. New keys start with sk_test_ in sandbox and sk_live_ in live mode.
  • Phone numbers in E.164 format, for example +14155552671. A value in any other format returns HTTP 400 on send.
  • A paid Growth or Scale plan, or one top-up, before the first live code. Free plan credit does not cover phone codes.
  • Optional risk actions configured on the workflow: duplicated_phone_number_action, disposable_number_action and voip_number_action.
  • A place to receive the result: the check response, or the session decision payload if you use a workflow.
Phone verification screen asking the user to enter their mobile number with a country selector
The hosted phone step collects the number in international format. In standalone mode your own screen does the same and calls send.

Automate an SMS OTP in seven steps

  1. Create the application and its key. Open the Business Console, choose the application from the dropdown, then Developers then API keys. The primary key has full access. Create a separate key with only the access a service needs when more than one system calls the API.
  2. Choose the mode. Standalone pair if your UI collects the number and the code; the two calls are paired by the phone number and the verification id. Session flow if you want Didit to run the screens: add the PHONE feature to a workflow, create a session with POST /v3/session/ sending workflow_id, vendor_data and callback, then open session.url.
  3. Send the code. Call POST /v3/phone/send/ with the E.164 number. Set options.code_size, options.preferred_channel and options.locale, and pass your own vendor_data reference so the verification maps back to a user. The 5-minute window starts with the first send.
  4. Let the user type the code. Six digits in the documented example. If the code never arrives, use the documented retry route to retry within the window, or the next-channel route to move the verification. Neither creates a second verification.
  5. Check the code. Call POST /v3/phone/check/ with the same phone number, the code the user typed, the verification_id from send, and a risk action such as voip_number_action set to DECLINE. Your application's verification.max_attempts setting defaults to 5 wrong entries.
  6. Branch on the status, not on the digits. A correct code returns Approved. A wrong code returns Failed with attempts remaining, so re-prompt. Declined ends the verification, and Expired or Not Found means the window closed or no verification is pending for that number.
  7. Chain the next check. In a session workflow the phone result sits in phone_verifications[] on the decision payload, and the same session can continue into ID verification, passive liveness, face match and AML screening. Fetch the outcome with GET /v3/session/{sessionId}/decision/ or subscribe to session.status.updated on a webhook.
# Step 3: send the code (standalone pair, sandbox key)
curl -X POST 'https://verification.didit.me/v3/phone/send/' \
  -H "x-api-key: $DIDIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "phone_number": "+14155552671",
    "options": {
      "code_size": 6,
      "preferred_channel": "sms",
      "locale": "en-US"
    },
    "vendor_data": "user-1234"
  }'

# Step 5: check the code the user typed
curl -X POST 'https://verification.didit.me/v3/phone/check/' \
  -H "x-api-key: $DIDIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "phone_number": "+14155552671",
    "code": "123456",
    "verification_id": "PASTE_VERIFICATION_ID_FROM_SEND",
    "voip_number_action": "DECLINE"
  }'
Code entry screen with a six-digit SMS code typed into the input boxes
The user types the six digits. Your server calls check with that code and the verification id from send.

Expected output

A correct code returns Approved together with the number's metadata. The check response carries the full phone record, so you can store one result and read the risk fields from it.

What the check call returns for a good code
FieldValue in a clean checkWhat you do with it
statusApprovedLet the user continue
carrier and line typemobileTreat landline or VoIP according to your policy
is_disposablefalseBlock or review throwaway numbers
is_virtualfalseVirtual numbers are weak proof of possession
portedfalseA recent port is a takeover signal worth a second look
warnings[]none on a clean checkAny PHONE warning changes the branch
Didit Business Console session detail panel showing the phone verification result and risk fields
The same result appears in the Business Console on the session, next to the document and liveness steps of the same person.

Failure cases and recovery

OTP failure modes, what you see and how to recover
SituationWhat you seeRecovery
Number not in E.164HTTP 400 on /v3/phone/send/Normalize with the country code, then send again
Anti-abuse blockstatus is Blocked with reason spamNo code was sent and nothing is charged. Stop and review the number
Wrong digitsFailed with attempts remainingRe-prompt. The user can retry inside the same window
Attempt budget exhaustedDeclined with the attempts warningThe verification ended. Start a new verification with a fresh send
Window closed, or no pending verificationExpired or Not FoundSend a fresh code. The default window is 5 minutes
Message never deliveredOTP_DELIVERY_FAILED warningUse the next-channel route, or the retry route inside the same window
Risky numberDUPLICATED_PHONE_NUMBER, DISPOSABLE_NUMBER, VOIP_NUMBER, INVALID_PHONE_NUMBERApply the workflow action you configured, or send the case to review
Blocked numberPHONE_NUMBER_BLOCKEDRefuse the sign-up without sending a chargeable code
Key problem401 for a wrong or revoked key, 403 for a missing key or a missing scopeUse a key with the access this route needs, from Developers then API keys
Rate limited429 with a wait field in secondsBack off for that many seconds, then retry

Inputs and outputs

Fields on the send and check calls
FieldDirectionDetail
phone_numberInputE.164 format. The same number is used on send and check
options.code_sizeInputDigits in the code. The documented example uses 6
options.preferred_channelInputsms, whatsapp, telegram or voice. Delivery falls back to SMS when the channel is unavailable
options.localeInputLanguage of the message
options.sms_sender_nameInputSigns one code with a different sender name, 1 to 30 characters
vendor_dataInputYour own user reference, kept with the verification
verification_idInputReturned by send, added to check to validate that specific verification
codeInputThe digits the user typed into your UI
voip_number_actionInputWhat to do when the number is VoIP, for example DECLINE
statusOutputNot Started, In Progress, Approved, Declined, Failed, Expired or Not Found, Abandoned, Kyc Expired
carrier, line type, portedOutputMetadata about the number behind the code
is_disposable, is_virtualOutputThrowaway and virtual number signals
warnings[]OutputPHONE risk codes, including OTP_MAX_ATTEMPTS_REACHED and OTP_EXPIRED

Phone codes are billed per code, not per session: the carrier price for the country and channel plus our $0.02 fee. Only the $0.02 part takes the plan discount, 4% on Growth and 10% on Scale, and carrier charges pass through at cost. A send that is blocked by anti-abuse protection sends no code and costs nothing. Sending codes needs a paid Growth or Scale plan or one top-up, because Free plan credit excludes phone codes; sandbox testing stays free and unlimited either way. That carrier-plus-fee price is the documented phone verification pricing.

  • A full ID check after the OTP is $0.33: document $0.15, passive liveness $0.10, face match 1:1 $0.05 and device and IP analysis $0.03.
  • AML screening is $0.20 per check, and ongoing monitoring is $0.07 per person a year.

The review boundary matters more than the price. An approved OTP is an authentication factor: it shows the person holds the number right now. It does not establish that the person is who they claim to be, so a KYC decision needs the document, passive liveness and face match behind it. On the fraud side, disposable, virtual and duplicate-number warnings are the point where your policy, or a reviewer, decides rather than the code. AML hits go to a person by design.

Worked cost example

Assume 10,000 new users a month in the United States, each verified by SMS OTP, with 30% continuing to a full ID check after the code is approved. All figures are published unit prices, before tax.

  • SMS codes at list price: 10,000 x $0.0473 = $473.00
  • Full KYC at list price: 3,000 x $0.33 = $990.00
  • Monthly total at list price: $473.00 + $990.00 = $1,463.00

On Growth the Didit fee drops 4% while the carrier price stays: $0.0473 becomes $0.0273 carrier + $0.0192 fee = $0.0465 per code. 10,000 x $0.0465 = $465.00, and 3,000 x $0.3168 = $950.40, so the month costs $1,415.40. On Scale: 10,000 x $0.0453 = $453.00 plus 3,000 x $0.297 = $891.00, or $1,344.00 for the same volume.

WhatsApp codes cost less than SMS in several countries: $0.0431 in the United States against $0.0473 by SMS. We run identity and fraud checks for 4,000+ companies. Channel prices vary by country and by channel, so the same volume can cost different amounts depending on where your users are and how they receive the code.

Sources

Next step: create a free application at business.didit.me, no sales call, and run the send and check pair with your sandbox key. Once the Approved, Failed and Expired branches behave the way you want, switch to your live key and let the codes bill against plan credit or a top-up.

Try it

Try this in the sandbox

Run the check this guide describes, free.

ID Verification

The product this post is about, taken from its topic. Run it free in the sandbox.

$0.15 per checkStart free

Author

Alberto Rosas

Co-founder and CEO

Alberto Rosas

Alberto Rosas

Co-founder and CEO

About Didit

Questions

Frequently asked questions

What does automating SMS OTPs mean in practice?

It means one API call sends the code and a second call validates it, with the expiry, the attempt limit and the number's risk metadata handled by the provider. Didit returns the verification status plus carrier, line type, disposable, virtual and ported signals from the same check call, so you do not need a separate lookup to decide what to do with a number.

How much does Didit charge per SMS OTP?

Each code costs the carrier price for the country and channel plus a $0.02 Didit fee. At list price that is $0.0473 for a US SMS, $0.0783 for a UK SMS and $0.1145 for a German SMS. On Growth the fee is $0.0192 and on Scale $0.018, and the carrier price passes through at cost.

Can I use the free plan to send SMS codes?

No. Free plan credit does not cover phone verification codes, so a live application needs a paid Growth or Scale plan or one top-up before the first code. Sandbox testing is free and unlimited and lets you test the send and check pair without spending credit.

How long does an SMS OTP last and how many attempts does a user get?

The default window is 5 minutes from the first send, and a retry inside the same window keeps that deadline. A standalone verification allows 5 wrong code entries by default, set by your application's verification.max_attempts setting. After that the verification returns Declined and the user has to start again.

Can I send the code over WhatsApp, Telegram or a voice call instead of SMS?

Yes. Set options.preferred_channel to whatsapp, telegram or voice, and delivery falls back to SMS when the channel is unavailable. A fixed line that cannot receive an SMS may have an eligible code read out in a call instead, priced as a voice code, and that read-out never applies to a repeat, a reused pending code, a destination without voice or a sandbox send.

Can the SMS carry my company name instead of an unknown sender?

Yes. SMS codes carry your app's SMS sender name on every send at no extra cost, and you set it in the Business Console. options.sms_sender_name signs a single code with another name of 1 to 30 characters. WhatsApp codes use a fixed message, and you can connect your own WhatsApp Business number to send them under your business name.

How do I stop disposable and VoIP numbers from signing up?

Configure disposable_number_action and voip_number_action on the workflow so the check declines those numbers, or set the action per call, for example voip_number_action set to DECLINE. The check response also carries is_disposable, is_virtual and the line type, so you can write your own rule on top of the returned data.

How do I catch one phone number used across many accounts?

Set duplicated_phone_number_action on the workflow and Didit raises the DUPLICATED_PHONE_NUMBER warning when the number was already seen. You can also query the List Phone Verifications API with the phone_number filter to see the earlier records, filtered by status, channel or creation time.

Is an approved SMS OTP enough for KYC?

No. An approved OTP shows the person controls the number at that moment, which is an authentication factor, not an identity check. A full ID check adds document verification, passive liveness and face match 1:1 for $0.33. Add AML screening at $0.20 per check and the two come to $0.53.

How do I test SMS OTP automation without spending money?

Create a sandbox application in the Business Console and use its sk_test_ key as the DIDIT_API_KEY. Sandbox testing is free and unlimited, and every check is mocked, so you can exercise the Approved, Failed, Declined and Expired branches before you spend a cent.

What happens when a code is never delivered?

The check result carries an OTP_DELIVERY_FAILED warning. Use the documented next-channel route to move the verification, or the retry route to try the code again inside the same window. A message blocked by anti-abuse protection returns Blocked with reason spam, sends no code and is not charged.

Compliance built in

Audited, certified and attested.

We hold the certifications and build each country's rules into your flows, so you can launch anywhere without worrying. Security and Compliance center

  • Regulation encoded into your flows

    Tell us what you do and where. Didit lists the rules that apply to you, with sources, and builds the checks each country needs into one workflow.

  • Ready for AMLR

    Every requirement of the new EU anti-money laundering rules, from checking customers to human review, is already covered by a Didit check.

  • Tested in Spain's Treasury sandbox

    Spain's Treasury published its supervised sandbox report on Didit's NFC plus active liveness onboarding; SEPBLAC took part and valued the added measures positively.

  • Audited, not self-declared

    iBeta Level 1 and Level 2. Liveness tested under ISO/IEC 30107-3.

Compliance assistant

Your obligations · 3 regions

EU · AMLRCustomer due diligence, human reviewCovered
Illinois, Texas, ColoradoExplicit biometric consentCovered
Germany · Youth protectionVerified adults only (JMStV)Covered
Workflow checked. Every obligation is met
  • SOC 2 Type 2
  • ISO 27001
  • iBeta Level 1 and Level 2
  • EU regulator attestation
  • FSM youth protection
  • GDPR
  • EBA remote onboarding
  • MiCA compatible
  • FIDO Alliance member
  • AMLREU AML Regulation ready

Integration · Didit MCP

Run Didit from your own AI agent

Connect Didit to Claude, Cursor, VS Code or ChatGPT and just ask in plain words. Your agent can do anything you can do in the console, with the same permissions you have.

Add to ClaudeChatGPT
Didit Academy · Lesson 04 · Use Didit with MCP
  • Build workflowsDescribe the checks you need. The agent creates and publishes the flow.
  • Run investigationsAsk why a session was declined, review cases, search people and companies.
  • Change rulesCreate payment rules, test them on past data and switch them on.
  • Pull reportsAsk for numbers, exports or the audit log.

Verify your first user today.

Start free

Free sandbox. Credit applies to work-email sign-ups.