Historical dataset
Authentication
The live API needs no key. The historical dataset takes an API key as a Bearer token.
Send the key
Put the key in the Authorization header of every dataset request:
Authorization: Bearer <your API key>curl "https://optimistfi.com/api/perps/data/history?base=TSLA&from=2026-10-01&to=2026-10-07" \
-H "Authorization: Bearer $OPTIMISTFI_API_KEY"Keep it safe
- Call the dataset from your server. A key in a browser or a mobile app can be read by anyone using it.
- Keep the key in an environment variable or a secret store, not in code.
- If a key is exposed, tell us through the contact form: it is revoked and a new one issued.
Keys are issued per team. Each key has its own rate limit.
When it fails
A missing or unknown key answers 401 with code unauthorized:
HTTP/1.1 401 Unauthorized
{
"error": "This dataset needs an API key: send Authorization: Bearer <key>. Keys are issued at optimistfi.com/perps/data/request.",
"code": "unauthorized",
"requestId": "b2a7c9e14f0d4a8e9c3b6f1e0d2a5c7b"
}
