Responses and Error Codes
All responses are in JSON format. The HTTP status always reflects the result, so checking the status is enough, and the body can be parsed according to the format below.
Successful response
Data is in data, service info (pagination, refunds, retry flag) is in meta. The meta field is not always present.
{
"data": {
"id": "4f2a9c1e7b3d48a6c5e0f1d2b3",
"status": "label_ready"
},
"meta": {
"duplicate": false
}
}Error response
The code field is stable and intended for programs, message is for humans (text may change and depends on language). details exist for field validation errors: the key is the field name, the value is the reason.
{
"error": {
"code": "validation_failed",
"message": "Check request fields",
"details": {
"parcel.weight_g": "Weight must be an integer greater than zero"
}
}
}Response headers
| Name | Description |
|---|---|
X-Request-Id | Request number. Include it in support requests so we can quickly find the request in the logs. Present in every response. |
X-RateLimit-Limit | Key request limit per minute. Only for requests with a key. |
X-RateLimit-Remaining | How many requests remain in the current minute. |
Retry-After | How many seconds to wait before retrying the request. Sent with a 429 response. |
Error codes
The main error indicator is error.code. One HTTP status can correspond to multiple codes.
| HTTP | Code | Description |
|---|---|---|
| 401 | unauthenticated | Нет заголовка Authorization: Bearer <ключ>. |
| 401 | invalid_key | Key is invalid, revoked, or expired. The response does not indicate whether the key exists. |
| 403 | insufficient_scope | Key lacks the required permission, specified in error.details.required_scope. |
| 403 | ip_not_allowed | Request came from an IP address not allowed for this key. |
| 403 | test_key_cannot_buy | Test key does not purchase labels or order pickups, use a live key. |
| 404 | not_found | Object not found among your account's objects (order, address, invoice, webhook, member, or team invitation), or the order has no active pickup, or the method does not exist. Objects belonging to others appear as non-existent. |
| 409 | conflict | Action is currently not possible for this order (e.g., order cannot be canceled or pickup already ordered). Reason text in error.message. |
| 409 | rate_expired | Rate is outdated or calculated for a different parcel or route. Request rates again. |
| 422 | validation_failed | Error in request fields. error.details specifies the reason for each field. |
| 422 | idempotency_key_required | Missing or invalid Idempotency-Key header: must be 16–64 characters A-Za-z0-9_-. |
| 402 | insufficient_funds | Insufficient funds on balance. Please top up your balance and retry. |
| 429 | rate_limited | Key request limit exceeded. Retry after the time specified in the Retry-After header. |
| 502 | provider_error | The carrier did not complete the operation. The money has been refunded automatically. |
| 503 | provider_unavailable | The carrier is temporarily unavailable. Please try again later. |
| 403 | owner_key_required | Командой может управлять только ключ, созданный владельцем аккаунта. |
| 422 | idempotency_key_reused | Этот Idempotency-Key уже использован для другого запроса: для нового запроса нужен новый ключ. |
Money and units of measurement
Amounts are only in whole US dollar cents (price_cents), tariffs additionally include a string price like 41.20. Weight in grams, dimensions in millimeters. Dates and times in ISO 8601 format (UTC).
Versions
The version is specified in the URL (/v1). Within a version, we only add fields and methods, so ignore unfamiliar fields in responses. Incompatible changes are released in a new version.