Get started

Errors and rate limits

Errors use standard HTTP statuses and one body shape with a stable code. Every response has a request id.

Error shape

An error response
HTTP/1.1 400 Bad Request
x-request-id: 3f9c1e0b7a6d4c2e9b8f1a0d5c4e3b2a

{
  "error": "class must be one of crypto, equity, index, fx, commodity",
  "code": "invalid_parameter",
  "requestId": "3f9c1e0b7a6d4c2e9b8f1a0d5c4e3b2a",
  "docs": "https://optimistfi.com/perps/data"
}

Branch on code; the message is for people and may be reworded.

Codes

StatusCodeMeaningWhat to do
400invalid_parameterA parameter is missing, out of range or not one of its allowed values. The message names it.Fix the request; retrying it unchanged fails the same way.
401unauthorizedA dataset endpoint was called without a valid API key.Send Authorization: Bearer <key>.
404not_foundNo such asset or endpoint.Check the path; list assets with /api/perps/assets.
429rate_limitedMore than 60 dataset requests in a minute on one key.Wait the seconds in Retry-After, then continue.
503unavailableNo venue, or the dataset, answered in time.Retry with backoff: 1, 2, 4 seconds.

Request ids

Every response carries an x-request-id header, and every error repeats it as requestId. Send your own x-request-id (8 to 64 letters, digits, dots, dashes or underscores) to trace a request end to end; it is echoed back. Quote it when you contact us about a request.

Rate limits

FieldMeaning
Live APINo key and no hard limit. Responses are served from data rebuilt every 4 seconds and cached at the edge, so polling faster than that returns the same answer.
Historical dataset60 requests a minute per API key, in a fixed one-minute window. Each response reports where the key stands; past the limit the answer is 429 with Retry-After.
Past the limit
HTTP/1.1 429 Too Many Requests
retry-after: 17
x-ratelimit-limit: 60
x-ratelimit-remaining: 0
x-ratelimit-reset: 1791403260
FieldMeaning
x-ratelimit-limitrequests allowed per minute
x-ratelimit-remainingrequests left in this minute
x-ratelimit-resetwhen the window resets, epoch seconds
retry-afterseconds to wait (on 429 only)

Retries

  • 400, 401, 404: do not retry unchanged; fix the request.
  • 429: wait the seconds in Retry-After.
  • 503: retry with exponential backoff (1, 2, 4 seconds), up to a few times.
ScoutJUST THIS STORY

LET’S MAKE THIS USEFUL · 1 OF 5

How would you like me to explain this?

Tell me what you want from this read. Start with a quick note, then adjust the details. Your other stories stay as they are.

We’ll remember your view of this story. The published article stays unchanged.

THIS STORY’S READING VIEWStandard · The whole picture

Clear explanations with context. Both sides of the evidence.