Check a verification code
const url = 'https://api.siprtc.io/v1/Account/example/VerificationsCheck';const options = { method: 'POST', headers: {Authorization: 'Basic <credentials>', 'Content-Type': 'application/json'}, body: '{"code":"482913","dst":"+15555550123"}'};
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/VerificationsCheck \ --header 'Authorization: Basic <credentials>' \ --header 'Content-Type: application/json' \ --data '{ "code": "482913", "dst": "+15555550123" }'Checks the code your user entered against the verification last sent to dst from your account with POST /Account/{auth_id}/Verifications. A matching code answers 200 with status success and marks the verification verified; a wrong code answers 401 with status failed and marks it failed, but the code stays valid until it expires, so the user can try again. Codes expire 2 minutes after the last send: after that, or for a number no code was sent to, the answer is 400. dst must be written exactly as in the send request.
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 ”The number and the code the user entered
object
The code your user entered, digits only.
Example
482913The number the code was sent to, written exactly as in the send request.
Example
+15555550123Responses
Section titled “ Responses ”Code matches: status success
object
“otp is verified” or “otp is not verified”.
Success when the code matches, failed when it does not.
ID of the send the code belongs to.
Example
{ "message": "otp is verified", "status": "success", "verifyid": "9b2f6c1e-3d4a-4f5b-8c7d-0e1f2a3b4c5d"}Body is not valid JSON, dst or code is missing, or no code is pending for dst (never sent, or expired)
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"}Code does not match: status failed (also used by the API gateway for wrong credentials, with a plain string body)
object
“otp is verified” or “otp is not verified”.
Success when the code matches, failed when it does not.
ID of the send the code belongs to.
Example
{ "message": "otp is verified", "status": "success", "verifyid": "9b2f6c1e-3d4a-4f5b-8c7d-0e1f2a3b4c5d"}