API reference

Verify a code

POST /api/v1/otp-verify — check a code the user entered against an otpId.

POST/api/v1/otp-verify

Checks a code the user entered against the otpId you received from Send a verification code.

Headers

Header Value
X-API-Key Your key (or Authorization: Bearer <key>)
Content-Type application/json

Request body

Field Type Required Description
otp_id string Yes The otpId value from the send response. otpId is accepted as an alias
otp string Yes The code the user entered. code is accepted as an alias

Only codes issued for your own account can be verified.

Response

Status 200 is returned for every verification outcome. Rely on the valid field.

Correct code:

JSON
{ "valid": true }

Incorrect code:

JSON
{ "valid": false, "reason": "Invalid OTP" }
reason Meaning
OTP not found The ID does not exist or does not belong to your account
Invalid OTP Wrong code (counts as an attempt)
OTP expired The code has expired
OTP already used The code was already used
Too many attempts More than 5 wrong attempts; the code was invalidated

After one successful verification, the code is used and cannot be verified again.

Errors

Status error
400 otp_id and otp required
401 Invalid API key
403 plan_no_api / permission_denied (the key needs the otp permission)
429 Too many requests (with a Retry-After header)

Examples

curl -X POST https://waabek.com/api/v1/otp-verify \
  -H "X-API-Key: $WABEK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "otp_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7", "otp": "482913" }'