Rate limited
RATE_LIMITED comes with HTTP 429. You hit one of your REST limits: your monthly credits are used up, or you sent too many requests within 10 seconds.
What it means
Every v3 REST route uses your plan's REST limits. There are two of them, and the limitType member of the error body tells you which one you hit:
limitType | Limit | Retry-After header | When it clears |
|---|---|---|---|
burst | Too many requests within a 10-second window. | Yes, in seconds (1 to 10). | When the window ends. |
monthly | Your monthly credits are used up. | No. | When your next billing period starts, or when you upgrade. |
The list of limitType values can grow. Treat an unknown value like monthly: do not retry. See Rate limits & credits for what uses a credit.
Example response
Burst limit:
Response headers (429)
HTTP/2 429
content-type: application/problem+json; charset=utf-8
retry-after: 7
Response (429): burst
{
"type": "https://docs.finlight.me/errors/rate-limited",
"title": "Too many requests",
"status": 429,
"detail": "Throttling Exception: Exceeded rate limit of 5 requests per 10 seconds.",
"code": "RATE_LIMITED",
"requestId": "req-123",
"limitType": "burst"
}
Monthly credits used up (no Retry-After header):
Response (429): monthly
{
"type": "https://docs.finlight.me/errors/rate-limited",
"title": "Too many requests",
"status": 429,
"detail": "Throttling Exception: Exceeded token limit of 1000 for the current period.",
"code": "RATE_LIMITED",
"requestId": "req-123",
"limitType": "monthly"
}
The numbers in detail are your plan's limits. Read limitType, not detail: the text can change.
Common causes
- Burst: a loop or many parallel workers send requests faster than your plan allows. Paging through results quickly with
searchAllcan also do this. - Monthly: your requests this billing period used all credits of your plan. Every search page, article lookup, company lookup and source list costs a credit.
How to fix
Burst
- Wait the number of seconds in
Retry-After, then send the request again. The refused request already used a credit, and the retry uses another one. - Spread your requests over time, or lower the number of parallel workers.
- Use larger pages (
limitup to 100) so you need fewer requests.
Monthly
- Do not retry. Requests fail until your next billing period starts.
- Check your usage in the finlight dashboard. The usage there is updated about once a day, so it can lag behind.
- Upgrade your plan on the pricing page if you need more credits.
- To save credits: keep company records for a day before you ask again (a revalidation costs 1 credit, even when it answers
304 Not Modified), use WebSocket or webhooks instead of polling, and ask forlimit: 100per page.
Retry
limitType | Retry |
|---|---|
burst | Once, after exactly Retry-After seconds. Use 10 seconds when the header is missing. |
monthly | Never. |
| anything else | Never. |
The client libraries follow these rules for you. A burst 429 is retried once after Retry-After, on by default. It does not count against the normal retry budget. A monthly 429 fails at once, also inside searchAll. To turn the burst retry off, set retryOnBurst: 'off' (TypeScript) or retry_on_burst="off" (Python). The other libraries have the same option.
In the SDKs
| Language | Error | Limit type | Retry-After |
|---|---|---|---|
| TypeScript | RateLimitedError | limitType | retryAfterMs (milliseconds) |
| Python | RateLimitedError | limit_type | retry_after (seconds) |
| Ruby | Finlight::RateLimitedError | limit_type | retry_after (seconds) |
| .NET | RateLimitedException | LimitType | RetryAfter (TimeSpan) |
| Java | RateLimitedException | limitType() | retryAfter() (Duration) |
| PHP | RateLimitedException | limitType() | retryAfter() (seconds) |
| Go | *finlight.APIError with APIKind == finlight.APIKindRateLimited | LimitType | RetryAfter (time.Duration) |
| Rust | Error::Api with api_kind() == ApiErrorKind::RateLimited | limit_type() | retry_after() (Duration) |
The limit type is monthly, burst, a newer value exactly as the server sent it, or unknown when the answer names none.
Handle a 429
import { RateLimitedError } from 'finlight-client'
try {
await client.articles.search({ query: 'ticker:NVDA' })
} catch (err) {
if (err instanceof RateLimitedError) {
if (err.limitType === 'monthly') {
console.log('Credits used up for this period')
} else {
console.log('Still too fast after one retry, wait', err.retryAfterMs, 'ms')
}
} else {
throw err
}
}
On WebSocket
The WebSocket does not use credits and never answers 429. It has its own limits:
- At connect, a used-up WebSocket quota or the connection limit gives HTTP
403. See Forbidden. - On an open connection, a used-up quota closes every connection of your account with a
connection.preemptedframe andreason: "quota_exceeded".
The test button for webhooks in the dashboard answers 429 after more than 10 test sends per minute per account. See Testing.