Send a verification code
const url = 'https://api.siprtc.io/v1/Account/example/Verifications';const options = { method: 'POST', headers: {Authorization: 'Basic <credentials>', 'Content-Type': 'application/json'}, body: '{"channel":"all","dst":"+15555550123","length":"4","src":"+15555550100","template":"Signup"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Authorizations
Section titled “ Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “ Path Parameters ”Your account Auth ID (20 characters)
Request Bodyrequired
Section titled “ Request Bodyrequired ”Who to verify and how
object
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).
Example
smsPhone number to verify, in E.164 with or without the leading +. The same string must be used in the check request.
Example
+15555550123Number of digits in the code, as a string. Default “6”; 4, 6 or 8 are the intended values.
Example
6Sender: 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.
Example
+15555550100Name 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.
Example
SignupResponses
Section titled “ Responses ”OK
object
Human-readable summary.
Always “pending”: the code is being sent.
Same value as verifyId.
ID of this send (the request ID). Also returned as verifyID.
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
object
Why the request was refused: a JSON or validation error, or a cache miss when no code is pending for the number.
Send requests only: ID of the refused request.
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)
Example generated
exampleA negative length
Example generated
example