Skip to Content
DevelopersErrors, Rate Limits & Versions

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" } }
FieldMeaning
typeThe broad category. Branch on this or on the status.
codeThe specific reason. Branch on this for cases you handle.
messageA sentence for your logs. Don’t parse it; the wording can change.
paramThe request parameter at fault, when there is one.

Codes

StatustypecodeRetry?
400invalid_request_errorinvalid_parameter, invalid_date_range, location_required, invalid_requestNo. Fix the request.
401authentication_errormissing_credential, invalid_credential, revoked_credential, expired_credentialNo. Get a new key.
403permission_errorinsufficient_scope, location_not_permitted, plan_requiredNo. The owner must change the key or plan.
404invalid_request_errorroute_not_found, location_missingNo.
429rate_limit_errorrate_limitedYes, after Retry-After.
500api_errorinternal_errorYes, with backoff.
503api_errorreplica_unavailable, report_timeoutYes, 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:

HeaderMeaning
RateLimit-LimitThe burst size, 50
RateLimit-RemainingRequests you can make right now
RateLimit-ResetSeconds 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.

  • /v1 only grows. Selflane may add endpoints, optional parameters, response fields, and new values for existing fields such as a new payment method. 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. /v1 of that resource keeps working for at least 12 months after /v2 ships. Deprecated responses carry Deprecation and Sunset headers, 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.
Last updated on