Errors and status codes#
The Verification API reports request failures with a non-successful HTTP status and an
errors array. A successfully created or retrieved verification can also contain an
unsuccessful outcome through its status, error_code, and error_detail fields.
Use the HTTP status to identify the error category and errors[].code to handle a specific
request failure. For a verification returned under data, inspect status first and use
error_code to determine why the verification failed, expired, or was denied.
HTTP error status codes#
Status |
Applies to |
When it occurs |
|---|---|---|
|
Requests with a JSON body |
The top-level |
|
All endpoints |
Credentials are missing or invalid, or the authentication mode is below the minimum configured for the OTP application. See Authentication. |
|
Start a verification |
The account balance is insufficient to start a verification. |
|
Status and report endpoints |
No matching verification exists for the supplied identifier or number. A by-number report can also return this status when no verification can receive the report. |
|
Start and report endpoints |
The JSON structure is valid, but one or more values fail validation or the submitted code cannot be accepted. |
|
Any endpoint |
The API or an intermediary encountered an unexpected failure. An API-generated
response may contain |
Error response object#
Every error response generated by the Verification API contains a top-level errors array.
A response can contain more than one error object, for example when several request fields
fail validation.
Field |
Type |
Description |
|---|---|---|
|
Array of objects |
The request errors returned by the API. |
|
|
Stable, machine-readable error code. Use this value in application logic. |
|
|
Fixed human-readable text associated with |
The following response contains one request validation error:
{
"errors": [
{
"code": "delivery_method_invalid",
"detail": "delivery method is invalid"
}
]
}
Note
A network failure, timeout, or response generated by a proxy can occur before the
Verification API returns JSON. Handle these failures separately instead of assuming that
an errors array is available.
HTTP error codes#
The following tables list the error codes published for the Verification API. New codes may be added over time. Preserve an unknown raw code and handle it using the HTTP status instead of rejecting or failing to decode the response.
Request validation codes#
Code |
Status |
Meaning |
Handling |
|---|---|---|---|
|
|
|
Supply a destination number. |
|
|
|
Correct the number before retrying. |
|
|
|
Supply a delivery method. |
|
|
|
Use |
|
|
The delivery method is invalid for the operation. On a report request, it can mean that the method does not match the verification. |
Use the method selected when the verification was started. |
|
|
|
Supply valid BCP 47 language tags. See SMS languages and phone call languages. |
|
|
|
Correct the Android SMS Retriever application hash or omit it. |
|
|
|
Supply the code received by the user. |
|
|
The destination cannot be verified with the selected delivery method. |
Choose another supported method or destination. |
Report submission codes#
Code |
Status |
Meaning |
Handling |
|---|---|---|---|
|
|
The submitted SMS or phone-call code is incorrect. |
Accept another value only if the verification remains active. The report counts toward the attempt limit. |
|
|
The verification succeeded previously, but the value submitted in this request is invalid. |
Do not treat this response as confirmation of the current submission. |
|
|
Challenge delivery has not reached a state in which the value can be reported. |
Wait for dispatch to complete, then submit the value again. |
|
|
The request failed a validation without a more specific code. |
Inspect the other error objects and correct the request. |
Warning
already_verified does not verify the value supplied in the current request. Do not use
it to grant access or confirm the current user.
Authentication, account, and lookup codes#
Code |
Status |
Meaning |
|---|---|---|
|
|
The request body does not contain a valid top-level |
|
|
Authentication failed. The response is intentionally generic and does not identify which credential or account condition caused the failure. |
|
|
The account balance is insufficient to start a verification. |
|
|
No matching verification was found for the authenticated OTP application. |
|
|
The request could not be completed because of an internal API error. |
Verification outcome codes#
When the API returns a verification object, status describes its current state. For a
failed, expired, or denied verification, error_code contains the
machine-readable reason and error_detail contains the corresponding human-readable text.
Both fields are null while the verification is pending and after it becomes
verified.
|
|
Status |
Meaning |
Handling |
|---|---|---|---|---|
|
|
|
The challenge could not be delivered to the destination. |
Start a new verification or choose another delivery method. |
|
|
|
The verification lifetime elapsed before successful reporting. |
Start a new verification. |
|
|
|
An incorrect code was reported too many times. |
Start a new verification. Do not submit another value to this verification. |
|
|
|
The destination could not be reached during challenge delivery. |
Check the number or choose another delivery method. |
|
|
|
The OTP application was deleted while the verification was in progress. |
Use an active OTP application and start a new verification. |
|
|
|
A newer verification for the same application and number replaced this one. |
Continue with the newer verification. |
|
|
|
The start request used |
Configure a callback URL before starting another verification. |
|
|
|
The request callback returned |
Review the authorization decision made by your backend. |
|
|
|
The callback timed out or returned an unusable response, such as a non- |
Correct the callback endpoint before starting another verification. |
too_many_attempts can first appear as errors[].code when a report is rejected. A
later status request returns the completed verification with status failed and
error_code too_many_attempts.
Handling errors safely#
Check the HTTP status to determine whether the API returned a successful response or an error response.
For a non-successful response, inspect every object in
errorsand branch oncode.For a verification returned under
data, inspectstatusand thenerror_code.Preserve unknown codes and handle them using the HTTP status or verification status. Do not fail response decoding only because a new code is introduced.
Use
detailanderror_detailfor display or logging only. Do not parse them or use them as application logic.
Warning
A report request can consume one of the allowed attempts. If a timeout or connection failure makes the result uncertain, retrieve the verification status before submitting the code again.