DocsWebsitePricingSupportConsole
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.

200 OK
{
  "valid": true,
  "result": "valid",
  "verification": { "id": "7c1e0b52-…", "status": "verified", "checks_left": 5 }
}
resultvalidMeaning
validtrueThe right code. It won't work again
invalidfalseA wrong code; checks_left says how many tries are left
max_attemptsfalseToo many wrong codes: this one is finished. Send a new one
expiredfalseThe code ran out of time. Send a new one
closedfalseAlready 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"}'