Errors, rate limits, and versions
Every Selflane API error has the same shape, so one handler covers them all. This page lists the codes, the rate limits, and the compatibility promise for /v1.
Error shape
An error returns an HTTP status of 400 or above and this body:
{
"error": {
"type": "invalid_request_error",
"code": "location_required",
"message": "This API key covers several locations; name one with ?location=",
"param": "location"
}
}| Field | Meaning |
|---|---|
type | The broad category. Branch on this or on the status. |
code | The specific reason. Branch on this for cases you handle. |
message | A sentence for your logs. Don’t parse it; the wording can change. |
param | The request parameter at fault, when there is one. |
Codes
| Status | type | code | Retry? |
|---|---|---|---|
400 | invalid_request_error | invalid_parameter, invalid_date_range, location_required, invalid_request | No. Fix the request. |
401 | authentication_error | missing_credential, invalid_credential, revoked_credential, expired_credential | No. Get a new key. |
403 | permission_error | insufficient_scope, location_not_permitted, plan_required | No. The owner must change the key or plan. |
404 | invalid_request_error | route_not_found, location_missing | No. |
429 | rate_limit_error | rate_limited | Yes, after Retry-After. |
500 | api_error | internal_error | Yes, with backoff. |
503 | api_error | replica_unavailable, report_timeout | Yes, after Retry-After. |
New codes can be added. Treat an unknown code by its status and type.
Rate limits
Each key gets 10 requests per second, with bursts of up to 50. Every response carries:
| Header | Meaning |
|---|---|
RateLimit-Limit | The burst size, 50 |
RateLimit-Remaining | Requests you can make right now |
RateLimit-Reset | Seconds until the full burst is available again |
Past the limit, the API answers 429 rate_limited with a Retry-After header in seconds. Wait that long, then retry. A 503 also carries Retry-After.
Requests with unrecognized keys are limited per IP address on top of this.
Lists and pagination
List endpoints return data and next_cursor:
{ "data": [ … ], "next_cursor": null }Today every list fits on one page, so next_cursor is always null and no endpoint takes cursor or limit yet. Larger resources, such as orders, will page: they’ll add cursor and limit parameters, and the API reference will list them. Check next_cursor now so your code is ready.
Versions
The API is versioned in the path: /v1.
/v1only grows. Selflane may add endpoints, optional parameters, response fields, and new values for existing fields such as a new paymentmethod. It doesn’t remove or rename fields, change their type or meaning, or make an optional parameter required.- Write tolerant clients. Ignore fields you don’t know, and handle unknown values in enum-like fields without failing.
- Breaking changes go in
/v2./v1of that resource keeps working for at least 12 months after/v2ships. Deprecated responses carryDeprecationandSunsetheaders, and Selflane contacts the businesses whose keys still use them. - Security fixes are the exception. If returning a field turns out to leak data, it stops right away and affected businesses are told directly.