curl -X POST https://verification.didit.me/v3/phone/send/ \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"phone_number": "+14155552671",
"options": {
"code_size": 6,
"preferred_channel": "whatsapp",
"locale": "en-US"
},
"vendor_data": "user-1234"
}'from didit import Didit
# Reads DIDIT_API_KEY.
client = Didit()
result = client.phone.send_code(
phone_number="+14155552671",
options={
"locale": "en-US",
"preferred_channel": "whatsapp",
},
vendor_data="user-1234",
)
print(result)import Didit from "@didit-protocol/sdk-node";
// Reads DIDIT_API_KEY.
const didit = new Didit();
const result = await didit.phone.sendCode({
phone_number: "+14155552671",
options: {
locale: "en-US",
preferred_channel: "whatsapp",
},
vendor_data: "user-1234",
});
console.log(result);ctx := context.Background()
// Reads DIDIT_API_KEY.
client := didit.NewClient()
result, err := client.Phone.SendCode(ctx, didit.PhoneSendCodeParams{
PhoneNumber: "+14155552671",
Options: didit.Some(didit.PhoneSendCodeParamsOptions{
Locale: didit.String("en-US"),
PreferredChannel: didit.Some(didit.PhoneSendCodeParamsOptionsPreferredChannel("whatsapp")),
}),
VendorData: didit.String("user-1234"),
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", result)import me.didit.Didit;
import me.didit.types.PhoneSendCodeParams;
// Reads DIDIT_API_KEY.
Didit client = new Didit();
var result = client.phone().sendCode(PhoneSendCodeParams.builder()
.phoneNumber("+14155552671")
.options(PhoneSendCodeParams.Options.builder()
.locale("en-US")
.preferredChannel(PhoneSendCodeParams.Options.PreferredChannel.of("whatsapp"))
.build())
.vendorData("user-1234")
.build());
System.out.println(result);<?php
require 'vendor/autoload.php';
use Didit\DiditClient;
// Reads DIDIT_API_KEY.
$didit = new DiditClient();
$result = $didit->phone->sendCode([
'phone_number' => '+14155552671',
'options' => [
'locale' => 'en-US',
'preferred_channel' => 'whatsapp',
],
'vendor_data' => 'user-1234',
]);
print_r($result->toArray());require "didit"
# Reads DIDIT_API_KEY.
didit = Didit::Client.new
result = didit.phone.send_code(
phone_number: "+14155552671",
options: {
locale: "en-US",
preferred_channel: "whatsapp",
},
vendor_data: "user-1234"
)
puts result.to_husing System;
using System.Text.Json;
using Didit;
// Reads DIDIT_API_KEY.
using var client = new DiditClient();
var result = await client.Phone.SendCodeAsync(new PhoneSendCodeParams
{
PhoneNumber = "+14155552671",
Options = new PhoneSendCodeParamsOptions
{
Locale = "en-US",
PreferredChannel = new PhoneSendCodeParamsOptionsPreferredChannel("whatsapp"),
},
VendorData = "user-1234",
});
Console.WriteLine(JsonSerializer.Serialize(result));{
"request_id": "e39cb057-92fc-4b59-b84e-02fec29a0f24",
"status": "Success",
"reason": null,
"vendor_data": "user-1234",
"metadata": null
}Send Phone OTP API: SMS Verification Code
POST /v3/phone/send/ to send an SMS one-time code. Auto-retry on blocked numbers, 5-min validity, pay-per-use pricing, no monthly minimums.
curl -X POST https://verification.didit.me/v3/phone/send/ \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"phone_number": "+14155552671",
"options": {
"code_size": 6,
"preferred_channel": "whatsapp",
"locale": "en-US"
},
"vendor_data": "user-1234"
}'from didit import Didit
# Reads DIDIT_API_KEY.
client = Didit()
result = client.phone.send_code(
phone_number="+14155552671",
options={
"locale": "en-US",
"preferred_channel": "whatsapp",
},
vendor_data="user-1234",
)
print(result)import Didit from "@didit-protocol/sdk-node";
// Reads DIDIT_API_KEY.
const didit = new Didit();
const result = await didit.phone.sendCode({
phone_number: "+14155552671",
options: {
locale: "en-US",
preferred_channel: "whatsapp",
},
vendor_data: "user-1234",
});
console.log(result);ctx := context.Background()
// Reads DIDIT_API_KEY.
client := didit.NewClient()
result, err := client.Phone.SendCode(ctx, didit.PhoneSendCodeParams{
PhoneNumber: "+14155552671",
Options: didit.Some(didit.PhoneSendCodeParamsOptions{
Locale: didit.String("en-US"),
PreferredChannel: didit.Some(didit.PhoneSendCodeParamsOptionsPreferredChannel("whatsapp")),
}),
VendorData: didit.String("user-1234"),
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", result)import me.didit.Didit;
import me.didit.types.PhoneSendCodeParams;
// Reads DIDIT_API_KEY.
Didit client = new Didit();
var result = client.phone().sendCode(PhoneSendCodeParams.builder()
.phoneNumber("+14155552671")
.options(PhoneSendCodeParams.Options.builder()
.locale("en-US")
.preferredChannel(PhoneSendCodeParams.Options.PreferredChannel.of("whatsapp"))
.build())
.vendorData("user-1234")
.build());
System.out.println(result);<?php
require 'vendor/autoload.php';
use Didit\DiditClient;
// Reads DIDIT_API_KEY.
$didit = new DiditClient();
$result = $didit->phone->sendCode([
'phone_number' => '+14155552671',
'options' => [
'locale' => 'en-US',
'preferred_channel' => 'whatsapp',
],
'vendor_data' => 'user-1234',
]);
print_r($result->toArray());require "didit"
# Reads DIDIT_API_KEY.
didit = Didit::Client.new
result = didit.phone.send_code(
phone_number: "+14155552671",
options: {
locale: "en-US",
preferred_channel: "whatsapp",
},
vendor_data: "user-1234"
)
puts result.to_husing System;
using System.Text.Json;
using Didit;
// Reads DIDIT_API_KEY.
using var client = new DiditClient();
var result = await client.Phone.SendCodeAsync(new PhoneSendCodeParams
{
PhoneNumber = "+14155552671",
Options = new PhoneSendCodeParamsOptions
{
Locale = "en-US",
PreferredChannel = new PhoneSendCodeParamsOptionsPreferredChannel("whatsapp"),
},
VendorData = "user-1234",
});
Console.WriteLine(JsonSerializer.Serialize(result));{
"request_id": "e39cb057-92fc-4b59-b84e-02fec29a0f24",
"status": "Success",
"reason": null,
"vendor_data": "user-1234",
"metadata": null
}Name your brand in the SMS
SMS codes carry your application’s SMS sender name, set in the Business Console, at no extra cost:123456 is your verification code for Acme BankTo sign one code with a different name, pass
options.sms_sender_name (1 to 30 characters: letters, digits, spaces and ’ & - ! only, not only digits):
{
"phone_number": "+14155552671",
"options": {
"preferred_channel": "sms",
"sms_sender_name": "Acme Bank"
}
}
400 and no code is sent.
WhatsApp codes use a fixed message and are not branded; connect your own WhatsApp Business number in the Business Console to send them from your business name. See Send WhatsApp codes from your own number.
See Branded verification messages for which name a code carries and the daily limit on new names.
Handle provider outages
If the phone provider is temporarily unavailable, this endpoint returns502 with a stable machine-readable code:
{
"detail": "The phone verification provider is temporarily unavailable.",
"code": "phone_provider_unavailable"
}
Authorizations
Your application's API key, from Developers -> API keys in the Business Console. The primary key has full access. A named key can be scoped: none, read or write per resource, limited to some workflows or to approved sessions, to a list of IP addresses, and to an expiry date. 401 means the key is wrong, revoked or expired; 403 means no key was sent, the key has no access to this resource or action, or the request came from an address outside its IP list; 404 on a session route means the session is outside the key's workflows or statuses. A key without media access receives image, video and PDF URLs as null, and a key without sessions write receives session links and tokens as null. See https://docs.didit.me/console/api-keys.
Body
Response
Send acknowledged. Inspect status: Success and Retry mean a code is on its way; Blocked means the anti-fraud layer refused and the verification is already finalized as Declined. request_id is the persisted session id (same id on a Retry).
Success — OTP sent to a new verification. Retry — OTP re-sent for the pending verification created by a previous send. Blocked — the anti-fraud layer refused to send; the verification is immediately finalized as Declined and nothing is billed.
Success, Retry, Blocked