Forbidden

FORBIDDEN comes with HTTP 403. Your key is valid, but your plan does not allow this request.


What it means

On the REST API, only the company routes can answer 403:

  • GET /v3/companies
  • GET /v3/companies/{companyId}

They need company data in your plan (the entityAccess entitlement). Without it, every request to them is refused. The request uses no credit.

The article routes never answer 403. If your plan lacks a feature, such as companies or events, the matching block is simply left out of the article. Filters are never limited by plan. See Plans & entitlements.

Example response

cURL

curl 'https://api.finlight.me/v3/companies?q=NVDA' \
  -H 'X-API-KEY: YOUR_API_KEY' \
  -H 'X-Request-Id: req-123'

Response (403)

{
  "type": "https://docs.finlight.me/errors/forbidden",
  "title": "Forbidden",
  "status": 403,
  "detail": "Company master data requires the entityAccess entitlement.",
  "code": "FORBIDDEN",
  "requestId": "req-123"
}

Common causes

  • Your plan does not include company data. The detail is Company master data requires the entityAccess entitlement.
  • Your plan changed, for example after a downgrade.

How to fix

  1. Check your plan in the finlight dashboard.
  2. Compare plans on the pricing page and upgrade to a plan with company data.
  3. Until then, do not call the company routes. You can still filter articles by company (for example ticker:NVDA or tickers) on any plan.

Retry

Do not retry. The answer stays the same until your plan changes. The client libraries never retry a 403.

In the SDKs

LanguageError
TypeScript, Python, RubyForbiddenError
.NET, Java, PHPForbiddenException
Go*finlight.APIError with APIKind == finlight.APIKindForbidden
RustError::Api with api_kind() == ApiErrorKind::Forbidden

Catch a plan error

import { ForbiddenError } from 'finlight-client'

try {
  const companies = await client.companies.search({ q: 'NVDA' })
} catch (err) {
  if (err instanceof ForbiddenError) {
    console.log('Company data is not in this plan:', err.detail)
  } else {
    throw err
  }
}

On WebSocket

A WebSocket connection can be refused at connect with HTTP status 403. Many WebSocket libraries only show the status. The body tells the cases apart:

BodyCauseWhat to do
{"message":"Your subscription does not include WebSockets"}Your plan has no WebSocket access.Upgrade, or use REST or webhooks. Do not reconnect.
{"message":"Too many concurrent connections. Use x-takeover: true header to replace an existing connection."}You are at your connection limit.Close a connection you no longer need, or connect with x-takeover: true to replace the one that was quiet the longest. Otherwise wait about a minute before you try again.
{"message":"Too many concurrent connections"}Two connections were opened at the same moment and this one lost.Reconnect after a short wait.
{"message":"WebSocket quota exceeded for the current period"}Your WebSocket delivery quota for this billing period is used up.Wait for the next period, or upgrade. Trying more often does not help.

The connection limit is shared by enriched and raw connections, and by old and new SDK versions. A connection that has not sent a ping for 60 seconds no longer counts.

The client libraries end the stream when the plan has no WebSockets. At the connection limit they reconnect with a long wait. When the quota is used up, they try again once per hour by default and report each wait. See Lifecycle & limits.

An open connection can also be closed because of limits. Then it gets a connection.preempted frame, not a 403:

  • reason: "connection_limit": another connection replaced this one with x-takeover.
  • reason: "quota_exceeded": the WebSocket quota is used up. All your connections are closed.