Skip to main content
All Vouch SDK methods return Promises and throw errors as Axios errors when something goes wrong. This means you can use standard try/catch blocks to handle failures, inspect the HTTP status code, and surface meaningful messages to your users. Understanding the error surface helps you build resilient integrations that degrade gracefully under failure conditions.

Standard Error Handling Pattern

Wrap every SDK call in a try/catch block. Axios errors expose three distinct shapes depending on where the failure occurred: a server response, a network-level failure, or an unexpected client-side error.

HTTP Error Reference

The table below lists every HTTP status code the Vouch API returns, its cause, and the recommended resolution.

Identity Verification Errors

When an identity check fails, the verification result will have identityVerified: false along with a rejection_reason field that tells you exactly why the check did not pass. Inspect this field to present actionable feedback to your user rather than a generic failure message.
Identity verification errors are not HTTP errors — the API returns a 200 response with identityVerified: false. Check the rejection_reason field, not the HTTP status code, to understand why a verification failed.

Fraud Assessment Behavior

When the Vouch fraud engine encounters an internal error during scoring, it deliberately defaults to an AMBER flag rather than PASS. This fail-safe means the engine never auto-approves a transaction when it cannot complete a full assessment. Your integration should treat AMBER as requiring human review, not as a soft pass.
Never treat an AMBER result as an implicit approval. When the fraud engine errors, it returns AMBER as a conservative default. Always route AMBER results to a human reviewer or hold queue.

Retry Strategy

Apply different retry strategies depending on the error class. Retrying a 4xx error is almost always wrong — the request itself is malformed, so sending it again will produce the same failure.
  • 5xx errors — the server failed; retry with exponential backoff
  • 4xx errors — the client sent a bad request; fix the request before resending
  • Network errors — retry with backoff; the server may not have received the request
The following utility wraps any async SDK call with configurable retries and exponential backoff:
A 503 Service Unavailable response means Vouch’s infrastructure is temporarily unable to handle your request. Use exponential backoff and retry up to three times. If the error persists beyond your retry budget, surface a user-friendly message and check the Vouch status page. Avoid retrying indefinitely — use a maximum attempt cap and alert your team if the threshold is exceeded.
Only retry on network errors or 5xx responses. If the identity check returned identityVerified: false with a rejection_reason, retrying the same images will produce the same result. Prompt the user to retake their photo or document scan based on the specific rejection reason before submitting again.
Log the triggered signals from fraud assessments (available in fraudResult.data.signals) alongside the flag value. These signal arrays are invaluable for debugging false positives and tuning your review workflows over time.