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
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
| Status | Code | Meaning | What to do |
|---|---|---|---|
| 400 | invalid_parameter | A 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. |
| 401 | unauthorized | A dataset endpoint was called without a valid API key. | Send Authorization: Bearer <key>. |
| 404 | not_found | No such asset or endpoint. | Check the path; list assets with /api/perps/assets. |
| 429 | rate_limited | More than 60 dataset requests in a minute on one key. | Wait the seconds in Retry-After, then continue. |
| 503 | unavailable | No 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
| Field | Meaning |
|---|---|
Live API | No 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 dataset | 60 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. |
HTTP/1.1 429 Too Many Requests
retry-after: 17
x-ratelimit-limit: 60
x-ratelimit-remaining: 0
x-ratelimit-reset: 1791403260| Field | Meaning |
|---|---|
x-ratelimit-limit | requests allowed per minute |
x-ratelimit-remaining | requests left in this minute |
x-ratelimit-reset | when the window resets, epoch seconds |
retry-after | seconds 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.

