Not found

NOT_FOUND comes with HTTP 404. There is no article or company for the id or link you asked for.


What it means

The single lookups answer 404 when nothing matches:

  • GET /v3/articles/{id}
  • GET /v3/articles/by-link
  • GET /v3/companies/{companyId}

The two article lookups also answer 404 for an article that exists but that your key cannot fetch: it comes from a custom source that was not granted to you, or it lies outside your plan's date window. The answer is the same as for an article that does not exist, so the response does not tell you which case it is.

The search never answers 404. A search without results returns "articles": []. A company lookup with ids leaves unknown ids out of the result instead.

Example response

cURL

curl 'https://api.finlight.me/v3/articles/AAAAAAAAAAAAAAAAAAAAAA' \
  -H 'X-API-KEY: YOUR_API_KEY' \
  -H 'X-Request-Id: req-123'

Response (404)

{
  "type": "https://docs.finlight.me/errors/not-found",
  "title": "Not found",
  "status": 404,
  "detail": "No article with id 'AAAAAAAAAAAAAAAAAAAAAA'.",
  "code": "NOT_FOUND",
  "requestId": "req-123"
}

Common causes

RoutedetailCause
GET /v3/articles/{id}No article with id '...'.The id is wrong, or the article was indexed before article ids existed. Those older articles have no id lookup.
GET /v3/articles/by-linkNo article with link '...'.The link does not match exactly. It must be the article's link value, character for character.
Both article lookupsSame detail as aboveThe article is from a custom source that was not granted to your subscription.
Both article lookupsSame detail as aboveThe article is outside your plan's date window (history or delay).
GET /v3/companies/{companyId}No company with id '...'.No company has this id.

How to fix

  • Article by id: use the id from an article you received from the API. If you only have the link, or the article is older, use GET /v3/articles/by-link. It also finds articles that have no id lookup.
  • Article by link: send the link exactly as the API delivered it, URL-encoded in the query string. Do not add or remove www, a trailing slash or tracking parameters.
  • Article exists, but the lookup still answers 404: check the source in GET /v3/sources. A custom source that was not granted to you is not listed there, and its articles cannot be fetched. Then check your plan's history and delay: an article outside that window cannot be fetched either. See Which articles you can fetch.
  • Company: use the companyId from an article (companies[].companyId) or from a company search. A path that is not a number is a validation error, not a 404.

See Get an article and Companies.

Unknown routes

A route that does not exist, such as GET /v3/nope, also answers 404, but in a simpler form without code:

Response (404)

{
  "message": "Cannot GET /v3/nope",
  "error": "Not Found",
  "statusCode": 404
}

Check the method and the path. The client libraries report this as a not-found error too.

Retry

Do not retry. The client libraries never retry a 404.

A request that answers 404 still costs 1 credit, on the article routes and on the company lookup alike. See Rate limits & credits.

In the SDKs

LanguageError
TypeScript, Python, RubyNotFoundError
.NET, Java, PHPNotFoundException
Go*finlight.APIError with APIKind == finlight.APIKindNotFound
RustError::Api with api_kind() == ApiErrorKind::NotFound

A 404 is an error in every library, never an empty result.

Fall back to the link

import { NotFoundError } from 'finlight-client'

async function loadArticle(id: string, link: string) {
  try {
    return await client.articles.get(id, { include: ['events'] })
  } catch (err) {
    if (err instanceof NotFoundError) {
      return await client.articles.getByLink(link, { include: ['events'] })
    }
    throw err
  }
}