heyvisa

Errors

The HeyVisa API uses conventional HTTP status codes and returns a machine-readable error object on every failure. Use the type and code fields to branch your handling, and always log request_id when contacting support.

Error response shape

Errors are always wrapped in a top-level error object. The request_id is unique per request and lets our team trace the exact call.

json
{
  "error": {
    "type": "invalid_request_error",
    "code": "document_unreadable",
    "message": "The uploaded passport scan could not be parsed. Re-upload a clearer image.",
    "param": "documents[0]",
    "request_id": "req_01HXYZ8K2M",
    "doc_url": "https://heyvisa.com/documentation/errors#document_unreadable"
  }
}

HTTP status codes

StatusMeaningWhen it happens
200 OKSuccessThe request completed and a body is returned.
202 AcceptedQueuedA report or document was accepted for async processing.
400 Bad RequestInvalid requestMalformed JSON, missing required fields, or invalid enum values.
401 UnauthorizedAuth failedMissing, malformed, or revoked API key.
402 Payment RequiredBilling issueQuota exhausted with no valid payment method on file.
403 ForbiddenNot permittedKey lacks scope for the resource or workspace.
404 Not FoundMissing resourceThe report, document, or webhook ID does not exist.
409 ConflictState conflictResource was already finalised or is being mutated concurrently.
422 UnprocessableValidation failedRequest was well-formed but a document failed semantic checks.
429 Too Many RequestsRate limitedYou exceeded your plan rate limit; inspect Retry-After.
500 Server ErrorInternal errorAn unexpected error on our side; safe to retry.
503 UnavailableTemporary outageA dependency is degraded; retry with backoff.

Error codes

Within a status, the code field narrows the cause. The most common application-level codes are listed below.

CodeHTTPMeaning
invalid_api_key401The provided key is unknown or revoked.
insufficient_scope403Key is valid but cannot access this resource.
quota_exceeded402Monthly report quota is used up; upgrade or add a payment method.
document_unreadable422OCR could not parse the upload; re-upload a clearer file.
unsupported_category400The requested visa category is not enabled for your workspace.
rate_limited429Too many requests in the current window.
internal_error500Unexpected failure; retry, then contact support if it persists.

Retry guidance

  • Never retry 400, 401, 403, 404, and 422 — these are deterministic and will fail again until you fix the request.
  • Retry with exponential backoff on 429, 500, and 503. Start at 1s and double up to a cap of 60s, with jitter.
  • For 429, honour the Retry-After response header (in seconds) instead of your own backoff when present.
  • Make write requests idempotent by sending an Idempotency-Key header so a retried POST does not create a duplicate report.
Always log the request_id
When you open a support ticket, include the request_id from the error body. It lets us locate the exact request in our logs without asking for reproduction steps, and is the fastest path to a resolution.