Skip to content

Send a verification code

POST
/v1/Account/{auth_id}/Verifications
curl --request POST \
--url https://api.siprtc.io/v1/Account/example/Verifications \
--header 'Authorization: Basic <credentials>' \
--header 'Content-Type: application/json' \
--data '{ "channel": "all", "dst": "+15555550123", "length": "4", "src": "+15555550100", "template": "Signup" }'

Generates a numeric one-time passcode (6 digits unless length says otherwise) for the number in dst and sends it asynchronously; the answer (status pending) comes before delivery. The code is held for 2 minutes per account and number: asking again within that time re-sends the same code, after it a new code is made. Check the code your user enters with POST /Account/{auth_id}/VerificationsCheck. channel sms sends a text from src (default sender ID “SIPRTC”); call places a voice call from src that speaks the digits; all (the default) sends the SMS first and, if it is not reported delivered within 90 seconds, also calls. Any other channel value sends nothing. A verification not checked within 180 seconds is recorded as timed out. The message is your account template named in template, else your account’s default template, else “Your OTP is ”. The SMS and the call are placed with your own credentials and billed to your account like any other message or call.

auth_id
required
string

Your account Auth ID (20 characters)

Who to verify and how

Media type application/json
object
channel

How to send the code: sms, call, or all (default: SMS first, then a voice call if the SMS is not delivered within 90 seconds).

string
default: all
Allowed values: all sms call

Example

sms
dst
required

Phone number to verify, in E.164 with or without the leading +. The same string must be used in the check request.

string

Example

+15555550123
length

Number of digits in the code, as a string. Default “6”; 4, 6 or 8 are the intended values.

string
default: 6
Allowed values: 4 6 8

Example

6
src

Sender: for SMS a sender ID or one of your numbers (default “SIPRTC”); for a call one of your numbers or verified caller IDs, E.164.

string

Example

+15555550100
template

Name of a verification template on your account (the template marks where the code goes with the OTP placeholder). Left out or unknown, your default template (or the built-in “Your OTP is ”) is used.

string

Example

Signup

OK

Media type application/json
object
message

Human-readable summary.

string
status

Always “pending”: the code is being sent.

string
verifyID

Same value as verifyId.

string
verifyId

ID of this send (the request ID). Also returned as verifyID.

string

Example

{
"message": "otp is generated and sending in progress",
"status": "pending",
"verifyID": "9b2f6c1e-3d4a-4f5b-8c7d-0e1f2a3b4c5d",
"verifyId": "9b2f6c1e-3d4a-4f5b-8c7d-0e1f2a3b4c5d"
}

Body is not valid JSON (for example length sent as a number instead of a string) or dst is missing

Media type application/json
object
error

Why the request was refused: a JSON or validation error, or a cache miss when no code is pending for the number.

string
verifyId

Send requests only: ID of the refused request.

string

Example

{
"error": "Key: 'VerifyRequest.Destination' Error:Field validation for 'Destination' failed on the 'required' tag",
"verifyId": "9b2f6c1e-3d4a-4f5b-8c7d-0e1f2a3b4c5d"
}

Missing or wrong Auth ID / Auth Secret (answered by the API gateway)

Media type application/json
string

Example generated

example

A negative length

Media type application/json
string

Example generated

example