Errors, rate limits and best practices
The error format, status and error codes, the rate guidance and a checklist for a safe integration.
3 min readUpdated Developers
Every error answers with the same JSON shape. Check success on every response and branch on error.code.
Error format#
{ "success": false, "message": "Validation failed", "error": { "code": "VALIDATION_ERROR", "message": "Latitude must be between -90 and 90" }}Some calls of the Trips API also return an optional error.details object, for example details.batch_id.
HTTP status codes#
Status | Meaning |
|---|---|
| Success |
| Created |
| Bad request: invalid input or validation error |
| Unauthorised: missing or invalid token |
| Forbidden: insufficient permissions |
| Not found |
| Payload too large |
| Unsupported media type: send |
| Unprocessable entity: validation failed |
| Internal server error |
| Bad gateway: an external service failed |
| Service unavailable |
Error codes#
Code | Meaning |
|---|---|
| Request validation failed |
| Authentication required or token invalid |
| Insufficient permissions |
| Resource not found |
| Trips API only. See Plan and approve trips for your own riders |
| Riders API ( |
|
|
| An external service (for example distance calculation) failed. Retrying later may help |
| The body could not be read: empty or broken JSON ( |
| Server-side error |
Rate limits#
There are no explicit rate limits at the moment. The recommendation is a maximum of 100 requests per minute per API user. Excessive requests may be throttled.
Best practices#
Tokens#
Store tokens in environment variables or secure storage.
Tokens expire after 90 days. Build refresh logic: on a
401, log in again.Never expose tokens in client-side code or logs.
Errors and retries#
Always check the
successfield.Retry
5xxresponses. A422 ROUTE_NOT_FOUNDand an unreadable body (400 BAD_REQUEST,415,413) cannot succeed on retry, so fix the request instead.Send an
Idempotency-KeyonPOST /api/tripsso a retry after a timeout is safe.Treat webhook deliveries as idempotent: the same update can arrive more than once.
Requests#
Use the estimate call before creating orders if you show distance to customers.
Cache estimates when appropriate: coordinates do not change.
Batch operations when possible, for example one
POST /api/tripsfor all queued orders.Validate coordinates before sending: latitude -90 to 90, longitude -180 to 180.
Security#
Use HTTPS in production.
Never share API keys. Rotate them periodically (see Get your API credentials).
Monitor API usage for anything suspicious.
What should I do on a 401?
Log in again with POST /auth/api/login and repeat the call with the new token.
Which errors are worth retrying?
5xx responses and EXTERNAL_API_ERROR. Do not retry ROUTE_NOT_FOUND or validation errors.
Was this page helpful?
Related guides
Test safely in the sandbox
Use the practice server to test orders, trips and webhooks without real riders: how the simulation runs and which scenarios exist.
3 min readDevelopers
Plan and approve trips for your own riders
Turn queued OUTLET orders into trips for your online riders, approve them in one call or in the portal, and read the trips back.
3 min readDevelopers
Receive order updates with webhooks
Set your webhook URL, check the X-API-SECRET header, read the order.updated payload and handle retries.
4 min readDevelopers
Add and manage your riders from your system
Create, list, update and remove your own riders with the delivery-executives endpoints, and what the rider does next.
4 min readDevelopers
