Skip to main content
David uses conventional HTTP status codes and returns errors as JSON with a single detail field.
{ "detail": "Scenario not found" }

Status codes

CodeMeaningCommon causes
200SuccessThe request succeeded.
400Bad requestInvalid parameter combination, for example interval other than day, or passing both ticker and holding to /index-funds.
401UnauthorizedMissing or invalid X-API-KEY header.
403ForbiddenYour key doesn’t have access to the requested resource.
404Not foundUnknown scenario_id, ticker, CIK, bank code, or artifact id.
422Unprocessable entityA request body or query parameter failed validation, for example a limit above the allowed maximum, or a malformed filter on a POST search endpoint.
429Too many requestsYou exceeded your key’s per-minute rate limit.

Validation errors

Validation errors (on POST search endpoints like /financials/search/screener, or on out-of-range query parameters) follow the standard FastAPI shape, listing each offending field:
{
  "detail": [
    {
      "loc": ["query", "limit"],
      "msg": "ensure this value is less than or equal to 10000",
      "type": "value_error"
    }
  ]
}

Handling rate limits

A 429 includes the rate-limit headers so you know your ceiling and when to retry. The window is a rolling 60 seconds.
{ "detail": "Rate limit exceeded" }
Response headers on every request:
HeaderDescription
X-RateLimit-LimitRequests allowed per minute.
X-RateLimit-RemainingRequests left in the current window.
X-Account-IDAccount tied to your key.
Use exponential backoff with jitter on 429 and 5xx responses. Monitor X-RateLimit-Remaining to throttle before you hit the limit.

Empty results vs. errors

David distinguishes “no data” from “error”:
  • A query for a valid scenario and ticker that simply has no rows returns 200 with an empty list (e.g. {"news": []}).
  • Non-operating instruments (ETFs, warrants, units) intentionally return empty operating-company datasets (statements, earnings, issuer filings, insider trades) rather than errors. See Ticker universe.
  • A genuinely unknown scenario_id or ticker returns 404.