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
| Status | type | What to do |
|---|---|---|
| 400 | invalid-request | Fix the request. See errors. Unknown query parameters, filters, sort fields, and field names are rejected. |
| 401 | invalid-token | Get a new token. Check that you use the right environment's credential. |
| 403 | insufficient-scope | The app lacks a permission. The WWW-Authenticate header names it. |
| 403 | ip-not-allowed | The app's IP rules block your server's address. |
| 403 | credit-not-allowed | Credit payment is for agent apps only. |
| 404 | not-found | The record does not exist, or the app may not see it. |
| 409 | not-cancellable | The booking includes a product that cannot be cancelled online. |
| 409 | booking-final | The booking is already cancelled or completed. |
| 409 | idempotency-in-progress | A request with the same Idempotency-Key is still running. Retry after Retry-After. |
| 422 | idempotency-key-reused | The key was used with a different body. Use a new key. |
| 422 | product-unavailable | The product cannot be booked on that date. |
| 422 | invalid-booking | The booking cannot be made. See detail. |
| 429 | rate-limited | Slow down. Wait for Retry-After seconds. |
| 503 | sandbox-writes-unavailable | Sandbox is read-only for now. |
| 500 | internal-error | Retry with backoff. If it keeps happening, contact support with the request_id. |
Retrying
- Retry
429,503(exceptsandbox-writes-unavailable), and500with exponential backoff and jitter. - Always send the same
Idempotency-Keywhen you retry a booking or a cancellation. - Do not retry
400,401,403,404,409, or422without changing something first.