Errors & Caching
What each error means, what to do next, and how not to pay twice
An error is JSON with an error object: a type to branch on, a message that says what went wrong, and sometimes extra keys that help you fix it, such as max_limit or retry_after_seconds. Errors aren't charged.
400 response
{
"error": {
"type": "invalid_parameter",
"message": "limit must be a whole number from 1 to 500.",
"max_limit": 500
}
}
Every error
| Status | Type | When | What to do |
|---|---|---|---|
400 | invalid_parameter | A parameter is wrong: an impossible date, a limit out of range, an unknown field or band value, a parameter the route doesn't take, or one given twice. | Fix what the message names. A limit out of range comes with max_limit. |
400 | request_too_large | A History request covers more rows than your plan allows in one request. | Split it by date range, asset_class or tickers. |
401 | authentication_required | No Authorization header, or not Bearer <key>. | Send Authorization: Bearer YOUR_API_KEY. See Authentication. |
401 | invalid_api_key | The key is malformed, unknown or deleted. | Copy it again, or create one under Dashboard → API keys. |
402 | insufficient_credit_balance | Paid plans: this month's credits are used and your balance can't cover the request. Comes with credits_required, credit_balance and buy_credits_url. | Add credits, or wait for your credits to renew. |
403 | tier_restricted | The date is before your plan's history, or you called a model endpoint on Free or Plus. Comes with upgrade_url. | Use a later date (history_start in Account), or upgrade. |
404 | ticker_not_found | The ticker is unknown. | Check the symbol and its format (ticker). |
404 | no_data | The ticker exists but there's no row to serve: nothing recent, nothing shortly before date, or nothing in the range. The message says which timeframe was read. | Try another date or timeframe. For a delisted company, ask for a date or range. |
404 | not_found | Unknown route, fund, insider or index. API paths have no trailing slash. | Check the path or the id against its list endpoint. |
405 | method_not_allowed | The route doesn't take this method. The Allow header lists the ones it does. | Use GET (History also takes POST). |
413 / 415 | payload_too_large, unsupported_media_type | A History POST body is too big, or isn't JSON. | Send a JSON object with Content-Type: application/json. |
422 | query_too_expensive | The query ran past your plan's limits (rows read, rows returned or time, below). | Narrow the date range, filters or limit. |
429 | rate_limit_exceeded | Either too many requests in 10 seconds (with Retry-After), or this month's credits are used and overage_enabled is off (always on Free), with reset. | Wait Retry-After seconds and retry (Rate Limits). For the monthly limit, wait for reset, turn on overage, or upgrade. |
429 | insufficient_credits | With overage off, a request that costs several credits costs more than you have left. Comes with credits_required and credits_remaining. | Ask for fewer rows, wait for your credits to renew, or upgrade. |
429 | too_many_concurrent_queries | Too many large queries are running on our side right now. Doesn't count against your credits. | Wait Retry-After seconds (2) and retry. |
429 | auth_rate_limited | Too many requests with an invalid key from your address. | Fix the key, then wait a few minutes. |
500 | internal_error | A fault on our side. The message says whether sending the same request again can work. | If it can, retry once. Otherwise, or if it fails again, contact support with the request. |
503 | upstream_unavailable, rate_limit_unavailable | Part of the service is briefly unavailable. | Retry shortly. |
Query limits
Each query runs under your plan's limits on time, rows read and rows returned. Past them, you get 422 query_too_expensive.
| Plan | Time limit |
|---|---|
| Free | 2 seconds |
| Plus | 5 seconds |
| Pro / Commercial | 15 seconds |
Caching
Data responses come with an ETag. Keep the response, and send the tag back in If-None-Match next time: 304 Not Modified means nothing new was published for that answer, and it costs no credits.
Conditional request
curl -i "https://api.tickerdb.com/v1/summary/AAPL" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H 'If-None-Match: W/"5f2c1a9e"'
# HTTP/1.1 304 Not Modified: nothing new, no credits used
- Data routes send
Cache-Control: private, no-cache: you can keep a response, but check it withIf-None-Matchbefore reusing it. - A repeat request without
If-None-Matchis charged again, even when we answer it from our cache. /v1/accountand errors areno-store: don't keep them./v1/statushas its ownETagandmax-age=30. Poll it to learn when new data is out.