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:

limitTypeLimitRetry-After headerWhen it clears
burstToo many requests within a 10-second window.Yes, in seconds (1 to 10).When the window ends.
monthlyYour 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 searchAll can 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

  1. 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.
  2. Spread your requests over time, or lower the number of parallel workers.
  3. Use larger pages (limit up to 100) so you need fewer requests.

Monthly

  1. Do not retry. Requests fail until your next billing period starts.
  2. Check your usage in the finlight dashboard. The usage there is updated about once a day, so it can lag behind.
  3. Upgrade your plan on the pricing page if you need more credits.
  4. 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 for limit: 100 per page.

Retry

limitTypeRetry
burstOnce, after exactly Retry-After seconds. Use 10 seconds when the header is missing.
monthlyNever.
anything elseNever.

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

LanguageErrorLimit typeRetry-After
TypeScriptRateLimitedErrorlimitTyperetryAfterMs (milliseconds)
PythonRateLimitedErrorlimit_typeretry_after (seconds)
RubyFinlight::RateLimitedErrorlimit_typeretry_after (seconds)
.NETRateLimitedExceptionLimitTypeRetryAfter (TimeSpan)
JavaRateLimitedExceptionlimitType()retryAfter() (Duration)
PHPRateLimitedExceptionlimitType()retryAfter() (seconds)
Go*finlight.APIError with APIKind == finlight.APIKindRateLimitedLimitTypeRetryAfter (time.Duration)
RustError::Api with api_kind() == ApiErrorKind::RateLimitedlimit_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.preempted frame and reason: "quota_exceeded".

The test button for webhooks in the dashboard answers 429 after more than 10 test sends per minute per account. See Testing.