Errors
The TOVR REST API error catalog. The error envelope, the six error types, every error code with its HTTP status and type, what to do about each, and retry rules. Every error's doc_url links to an entry on this page.
Every /api/v1 error answers with a non-2xx status and the same JSON envelope. Each error's
doc_url links to its entry on this page. The one exception is the token endpoint, which
answers OAuth-style string errors (see Authentication).
Response format
{
"error": {
"type": "invalid_request_error",
"code": "validation_failed",
"message": "The request did not match the expected shape.",
"details": [
{ "path": "stops.0.type", "code": "invalid_value", "message": "Invalid option: expected one of \"UNKNOWN\"|\"PICKUP\"|\"DELIVERY\"|\"WAYPOINT\"" }
],
"request_id": "req_8a41c2d9e0f34b6c9d7e5f1a2b3c4d5e",
"doc_url": "https://tovr.eu/docs/tovr/reference/errors#validation_failed"
}
}| Field | Always present | Description |
|---|---|---|
type | yes | The coarse bucket. It never gains a member without an API version bump. |
code | yes | The specific cause, from the closed list below. Branch on this. |
message | yes | A human-readable explanation, in English in every locale. Do not parse it. |
param | sometimes | The field or header at fault, when one can be named. |
details | sometimes | Machine-shaped specifics. For validation_failed, one entry per issue with path, code and message. |
request_id | yes | The same value as the X-Request-Id header. Quote it in a support request. |
doc_url | yes | A link to this page, at the entry for code. |
A client that switches on code needs a fallback per type, because codes can be added.
Types
type | Meaning |
|---|---|
authentication_error | The credentials are missing or not valid. |
permission_error | The caller is authenticated but not allowed to do this. |
invalid_request_error | The request cannot be served as sent. |
conflict_error | The request conflicts with data that already exists. |
rate_limit_error | The caller sent too many requests. |
api_error | A fault on TOVR's side or in a service TOVR depends on. |
All codes
code | Status | type | Retry? |
|---|---|---|---|
missing_credentials | 401 | authentication_error | After sending a token |
invalid_token | 401 | authentication_error | With a new token, unless the client application is deactivated or expired |
expired_token | 401 | authentication_error | With a new token |
insufficient_scope | 403 | permission_error | No |
forbidden | 403 | permission_error | No (reserved) |
quota_exceeded | 402 | permission_error | Next calendar month |
validation_failed | 422 (400 for Idempotency-Key) | invalid_request_error | No |
unknown_parameter | 422 | invalid_request_error | No (reserved) |
invalid_id | 422 | invalid_request_error | No |
invalid_cursor | 422 | invalid_request_error | From the first page |
contact_required | 422 | invalid_request_error | No |
org_not_reachable | 422 | invalid_request_error | No |
insufficient_market_data | 422 | invalid_request_error | Later |
cursor_expired | 410 | invalid_request_error | After a resync |
not_found | 404 | invalid_request_error | No |
rate_limited | 429 | rate_limit_error | After Retry-After |
duplicate_external_id | 409 | conflict_error | No |
external_id_owned_by_another_org | 409 | conflict_error | No |
idempotency_key_reuse | 409 | conflict_error | With a new key |
internal_error | 500 | api_error | No |
service_unavailable | 503 | api_error | With backoff |
Authentication errors
A 401 carries type authentication_error, one of the three codes below, and the header
WWW-Authenticate: Bearer error="invalid_token". It carries no rate-limit headers.
missing_credentials
401. The request has no Authorization header, the header does not start with Bearer , or
the token is empty. Send the access token with every request.
invalid_token
401. The signature is wrong, the token is unknown or revoked, or its client application is missing, deactivated or expired. Get a new token. When the client application is deactivated or expired, the token endpoint refuses a new token too. Settings → Developer cannot reactivate it, so create a new client application there.
expired_token
401. The token is genuine and older than its 3,600 s lifetime. Get a new token and retry.
Permission errors
insufficient_scope
403. The token does not have the scope this endpoint needs, or a webhook subscription names an event type whose read scope the token lacks. The scope catalog lists the scope for each endpoint. Scopes cannot be added to an existing client application: create one with the scope, then get a token from it. This refusal does not count against the rate limit.
forbidden
403. Reserved. No endpoint returns it today: an object that belongs to another organization
answers 404 not_found.
quota_exceeded
402, type permission_error. The client application has used its organization's monthly
request quota, or the monthly streaming minutes on GET /events/stream. Waiting inside the month
does not help. No Retry-After is sent. See
Rate limiting and quota.
Invalid request errors
validation_failed
422. The body, query or path parameters do not match the expected shape, or a value breaks a
rule the schema cannot express (an id in a create body, an empty PATCH, a refused status
transition, a UN number that is not one). A body that is not valid JSON is reported here too.
details lists each schema issue with its path; param names the field for the other cases. A
query parameter the endpoint does not accept is reported here too. An Idempotency-Key header
longer than 255 characters answers 400 with
param: "Idempotency-Key". Fix the request. Do not retry it unchanged.
unknown_parameter
422. Reserved. No endpoint returns it today: an unknown query parameter is a
validation_failed.
invalid_id
422, param: "endpoint_id". A webhook endpoint path carries an id that is not whe_<uuid>.
Send the id TOVR returned, with its prefix. On the other endpoints a malformed path id is
validation_failed.
invalid_cursor
422, param: "cursor" (or "after" on the change feed). The cursor was not issued by this
API, or it was issued for a different sort. Send next_cursor from the previous page
unchanged, or start again without a cursor.
contact_required
422, param: "contacts". POST /shipments needs at least one contact with a name and an
email or phone. Add the contact to the body.
org_not_reachable
422, param: "visibility". A shipment created with visibility public or platform needs
the organization's profile to state a contact email and a phone number. The message names what
is missing. Complete Settings → General, or create the shipment with visibility: "private".
insufficient_market_data
422. The request was valid, but there is not enough market data to price that lane.
details.estimate carries the estimate with zero prices and
quality_status: "INSUFFICIENT_DATA". Try a different lane, or try again later.
cursor_expired
410, param: "after". The cursor points before the 30-day retention window of the change
feed, so events after it are gone. Read current state again from the list endpoints, then resume
from the next_cursor of a new GET /events. See
Change feed.
not_found
404. The object does not exist, or it is not visible to this organization. The two cases answer the same on purpose.
rate_limited
429, type rate_limit_error. The client application sent more requests in this minute than
its plan allows. Wait the number of seconds in Retry-After, then retry. See
Rate limiting and quota.
Conflict errors
duplicate_external_id
409, param: "external_id". Your organization already has a shipment with this platform
and external_id. POST only creates: change the existing shipment with PATCH.
external_id_owned_by_another_org
409, param: "external_id". Another organization already has a shipment with this
platform and external_id. Choose an external_id unique to your own system.
idempotency_key_reuse
409, param: "Idempotency-Key". The key was already used for a different request (another
method, path or body). Use one key per operation, and reuse it only to retry that same request.
See Idempotency.
API errors
internal_error
500. A fault on TOVR's side. Retrying the same request does not help. Contact support and
quote the request_id. The one exception is POST /estimate and POST /estimate/batch: when the
pricing service fails or times out they answer 500, and a retry with backoff can succeed. See
APEX errors.
service_unavailable
503. A service TOVR depends on is not available. Today that is the pricing service: not
configured for the environment on POST /estimate and POST /estimate/batch, and not configured
or not answering on GET /market/overview. The request was valid. Retry with exponential backoff.
Retry strategy
| Response | Action |
|---|---|
429 rate_limited | Wait Retry-After seconds, then retry. |
503 service_unavailable | Retry after 1 s, 2 s and 4 s, then stop. |
401 expired_token | Get a new token, then retry once. |
401 invalid_token, missing_credentials | Fix the credentials. Retry once with a new token. |
402 quota_exceeded | Stop until the next calendar month or a plan upgrade. |
500 internal_error | Do not retry. Contact support with the request_id. |
Any other 4xx | Do not retry. Fix the request. |
Send an Idempotency-Key on every POST and PATCH you might retry, so a retry never creates
the same object twice.
Authentication
The OAuth 2.0 client-credentials token endpoint of the TOVR REST API, its parameters, responses and rate limits, the bearer token it issues, the 401 error codes, and the scope catalog.
Shipments
The shipments endpoints of the TOVR REST API. Create a shipment, list and read your shipments, and change a shipment's status or visibility. Request fields, the shipment object, list rows, status transitions and errors.