Requests, paging, errors and rate limits

Headers, paging, search and sorting, every error code, rate-limit headers, request ids and size limits.

6 min read Updated Oct 17, 2026

Request headers

HeaderWhen
Authorization: Bearer lnk_… (or X-Api-Key)Every request
Content-Type: application/jsonRequests with a body
Accept: application/jsonRecommended
X-Request-IdOptional: your own id (8–64 letters, digits, - or _) to trace a call; otherwise we make one

Paging, search and sorting

Lists return 50 records by default. Use per_page (up to 200) and page:

curl "https://api.leisurenexus.app/v1/items?per_page=200&page=2" -H "Authorization: Bearer lnk_…"
{
  "data": [ ... ],
  "meta": { "page": 2, "pages": 14, "per_page": 200, "total": 2716, "from": 201, "to": 400 }
}

Keep asking for the next page until page equals pages. Pages are in a stable order, so nothing is skipped or repeated while you page.

ParameterListsMeaning
searchitems, stock, customers, ordersPart of a name, SKU, company or receipt number
sortitems (name, updated, sku), customers (name, updated), orders (completed, total)Sort field
dirsameasc or desc
updated_sinceitems, customersOnly records changed after this time — ideal for syncing

Errors

Every error has the same shape:

{
  "error": {
    "code": "missing_scope",
    "message": "This key can't do that: it needs the customers.read scope."
  }
}

Invalid input adds fields, with messages per field:

{
  "error": {
    "code": "invalid_request",
    "message": "Another customer has this phone number.",
    "fields": { "phone": ["Another customer has this phone number."] }
  }
}
StatusCodeMeaningWhat to do
400bad_pathThe path has .., // or \Fix the URL
401invalid_keyMissing, unknown, expired or revoked keyCheck the key; create a new one
403missing_scopeThe key lacks the scopeAdd the scope (new key)
403merchant_inactiveThe business's account is not activeThe owner checks Billing
404not_foundNo such record, endpoint, or the feature isn't on for this businessCheck the id or path
405method_not_allowedWrong HTTP methodSee the endpoint reference
413too_largeBody over 1 MBSend fewer lines per request
422invalid_requestInput failed validationRead error.fields
429rate_limitedToo many requestsWait Retry-After seconds
500server_errorSomething failed on our sideRetry with backoff; quote X-Request-Id to support
502 / 504upstream_unavailable / upstream_timeoutBriefly unavailable or slow (30 s limit)Retry with backoff

Rate limits

Each key has its own limit per minute (120 by default, up to 1,200). Every response carries:

HeaderMeaning
X-RateLimit-LimitRequests allowed per minute for this key
X-RateLimit-RemainingRequests left in this minute
Retry-AfterOn a 429: seconds until you can try again

There is also a ceiling of 600 requests per minute per client address. To stay well under the limits, sync with updated_since instead of re-reading everything, use per_page=200, and react to webhooks instead of polling.

Retrying safely

GET requests can always be retried. A POST that timed out may still have worked: before sending it again, look the record up (for example GET /customers?email=…) so you don't create it twice.

Request ids and CORS

Every response has an X-Request-Id. Log it — support can find the exact request from it. CORS is open, but keys must stay on your server; call the API from your back end, not from browser code.

Still stuck? Email support@leisurenexus.com or send us a message — we're happy to help.