Skip to main content

Errors

Errors use RFC 9457 problem details with the content type application/problem+json. The token endpoint is the one exception: it returns OAuth errors.

{
"type": "https://developer.staging.agantia.com/errors/insufficient-scope",
"title": "Insufficient scope",
"status": 403,
"detail": "This request needs the scope(s): bookings:cancel.",
"instance": "/api/public/v1/bookings/43326/cancel",
"request_id": "b6f1c2d0-6a3e-4f43-9a51-1c7f0d0b2f9e"
}

Branch on type, not on detail: the detail text can change. For validation errors, errors lists each problem:

{
"type": "https://developer.staging.agantia.com/errors/invalid-request",
"title": "Invalid request",
"status": 400,
"detail": "One or more fields are invalid.",
"errors": [ { "field": "per_page", "message": "must be between 1 and 100" } ]
}

Error types​

StatustypeWhat to do
400invalid-requestFix the request. See errors. Unknown query parameters, filters, sort fields, and field names are rejected.
401invalid-tokenGet a new token. Check that you use the right environment's credential.
403insufficient-scopeThe app lacks a permission. The WWW-Authenticate header names it.
403ip-not-allowedThe app's IP rules block your server's address.
403credit-not-allowedCredit payment is for agent apps only.
404not-foundThe record does not exist, or the app may not see it.
409not-cancellableThe booking includes a product that cannot be cancelled online.
409booking-finalThe booking is already cancelled or completed.
409idempotency-in-progressA request with the same Idempotency-Key is still running. Retry after Retry-After.
422idempotency-key-reusedThe key was used with a different body. Use a new key.
422product-unavailableThe product cannot be booked on that date.
422invalid-bookingThe booking cannot be made. See detail.
429rate-limitedSlow down. Wait for Retry-After seconds.
503sandbox-writes-unavailableSandbox is read-only for now.
500internal-errorRetry with backoff. If it keeps happening, contact support with the request_id.

Retrying​

  • Retry 429, 503 (except sandbox-writes-unavailable), and 500 with exponential backoff and jitter.
  • Always send the same Idempotency-Key when you retry a booking or a cancellation.
  • Do not retry 400, 401, 403, 404, 409, or 422 without changing something first.