Building reliably
Errors and rate limits
Every error has the same shape, and a code that does not change.
Errors follow RFC 9457 (problem details). Branch on code, which is stable; the title is for people and may be reworded. Field problems are listed in errors, each with the field's name.
{
"type": "https://api.iboxdelivery.com/docs/errors#validation_failed",
"title": "Request body failed validation",
"status": 422,
"code": "validation_failed",
"errors": [
{ "field": "recipient_phone", "code": "too_small", "message": "Too small: expected string to have >=5 characters" }
],
"correlation_id": "c7e1d0a4-2f0b-4b8e-9d55-1a1b2c3d4e5f"
}Every error also carries an X-Correlation-Id header with the same value. Quote it when you contact us and we can find the request.
Codes
| Status | Code | Meaning |
|---|---|---|
| 400 | invalid_json | The body is not valid JSON. |
| 400 | idempotency_key_too_long | Idempotency-Key is over 255 characters. |
| 401 | unauthorized | The API key is missing, malformed, unknown or revoked. |
| 404 | shipment_not_found | No parcel of yours has that id. |
| 404 | not_found | No parcel of yours has that tracking number. |
| 409 | not_booked | A label was asked for a parcel that is not booked, for example a cancelled one. |
| 422 | validation_failed | A field is missing or wrong. errors[] names each one. |
| 422 | parcel_does_not_fit | No compartment takes a parcel this big or this heavy. See Parcel sizing. |
| 422 | unknown_station | No active station has that id. |
| 422 | station_unavailable | The station has no locker cabinet yet. |
| 422 | idempotency_key_reused | This Idempotency-Key was used for a different request. |
| 429 | rate_limit.exceeded | Too many requests. Wait for Retry-After seconds. |
Rate limits
Each API key may make 100 requests per minute, counted over a sliding window. Past that, requests answer 429 with a Retry-After header in seconds, and X-RateLimit-Limit and X-RateLimit-Remaining. Refused requests count too, so wait for Retry-After rather than retrying at once.
Retrying
429and5xxare worth retrying, with a growing pause. Bookings are safe to retry with an Idempotency-Key.- Other
4xxwill fail the same way until the request changes.