OTP
Check a code
Compares what the person typed with the code sent. Always send the code from your server, never from the person's browser or app.
By phone number#
POSThttps://api.siellabs.com/v1/verifications/check
Checks against the newest code sent to the number, so you needn't keep an id.
tostringRequired
The number the code went to.
codestringRequired
What the person typed.
By id#
POSThttps://api.siellabs.com/v1/verifications/{id}/check
codestringRequired
What the person typed.
Response#
Both answer 200 OK whether the code was right or not; 404 not_found when there's no such code.
{
"valid": true,
"result": "valid",
"verification": { "id": "7c1e0b52-…", "status": "verified", "checks_left": 5 }
}| result | valid | Meaning |
|---|---|---|
valid | true | The right code. It won't work again |
invalid | false | A wrong code; checks_left says how many tries are left |
max_attempts | false | Too many wrong codes: this one is finished. Send a new one |
expired | false | The code ran out of time. Send a new one |
closed | false | Already verified, or failed |
curl https://api.siellabs.com/v1/verifications/check \
-H "Authorization: Bearer $SMSGW_API_KEY" \
-H "Content-Type: application/json" \
-d '{"to": "+447700900123", "code": "482913"}'