Query Syntax

The query string lets you describe exactly which articles you want: words and phrases, conditions on fields such as ticker or eventType, and any mix of AND, OR and NOT. The same language works in REST search, WebSocket subscriptions and webhook criteria.

This page covers the building blocks. The other pages of this section go deeper:


Where you use a query

The query is one string. You send it in the query field of:

The grammar is the same everywhere. There is one difference in how strict the check is: REST v3 rejects unknown field names, WebSocket and webhooks do not. See Strict and lenient parsing.

The query is combined with AND with every other filter of the request, such as sources, languages or tickers.

Request

POST
/v3/articles/search
curl -X POST 'https://api.finlight.me/v3/articles/search' \
  -H 'Content-Type: application/json' \
  -H 'X-API-KEY: YOUR_API_KEY' \
  -d '{
    "query": "(ticker:NVDA OR ticker:AMD) AND eventType:earnings -crypto",
    "include": ["companies", "events"],
    "limit": 10
  }'

WebSocket subscribe

{
  "payloadVersion": 3,
  "query": "(ticker:NVDA OR ticker:AMD) AND eventType:earnings -crypto",
  "include": ["companies", "events"],
  "language": "en"
}

Webhook criteria

{
  "query": "(ticker:NVDA OR ticker:AMD) AND eventType:earnings -crypto",
  "language": "en",
  "includeUpdates": true
}

For webhooks you type the query into the Query field of the webhook in the dashboard. The JSON above shows how the saved criteria look.


Terms and phrases

A word on its own searches the whole article, including the title and the summary. Several words next to each other must all appear (see Boolean operators).

Nvidia earnings

Put words in double quotes to search for the exact phrase.

"interest rate cut"

Free text never matches company or event data. To find articles about a company, use a field such as ticker:NVDA rather than the company name.


Boolean operators

OperatorMeaningExample
spaceAll terms must match (same as AND)Tesla recall
ANDBoth sides must matchTesla AND recall
OREither side must matchTesla OR Rivian
AND NOTThe next term or group must not match. NOT alone means the sameTesla AND NOT China
-Same as AND NOT, written directly before a word, a phrase or a field condition. Not before a bracketTesla -China
+Marks a term as required. This is the default, so + changes nothing+Tesla recall

Rules:

  • Operators are not case sensitive: and, or and not work too. This also holds in a plain-text query: Fed will not cut rates excludes every article that has the word cut. To search for the words themselves, put them in quotes: Fed "will not cut" rates.
  • NOT binds tightest, then AND, then OR. So a OR b c means a OR (b AND c).
  • NOT without an operator before it means AND NOT. Tesla NOT China, Tesla AND NOT China and Tesla -China exclude the same articles. This also holds inside a bracket.
  • A query needs at least one condition that is not negated. -crypto alone, or NOT eventType:* alone, is rejected. Add a positive condition, for example bitcoin -crypto or ticker:NVDA AND NOT eventType:*.

Parentheses

Use round brackets to group conditions and control the order.

Tesla AND (recall OR lawsuit) AND NOT China
(ticker:NVDA OR ticker:AMD) AND eventType:earnings

Round brackets only group. They do not say that two conditions are about the same company. For that, use curly braces, see Correlation groups.


Field conditions

Write field:value to search one field. The usual form has no space around the colon, but spaces are allowed.

ticker:NVDA
eventType:mna
sourceType:newswire
bitcoin -source:www.example.com
  • Field names are not case sensitive. Ticker:NVDA and ticker : NVDA both work.
  • Values are case sensitive, with two exceptions: ticker and exchange values are converted to upper case for you. This does not apply to the SYMBOL@MIC form: write ticker:NVDA@XNAS, not ticker:nvda@xnas. role:Target is an error, role:target is right.
  • A value is one word. To match a multi-word value such as the sector Real Estate, use the flat sectors filter of REST search. Writing sector:"Real Estate" does not filter on the sector: it is read as the text sector: followed by a phrase.
  • Fields with a fixed list of values (sourceType, sentiment, role, eventType, eventDirection, eventImportance) reject unknown values with an error that lists the allowed ones.

All fields and their values are listed on Fields.


Wildcard

* as the value means "has any value". It is useful to require that a field is set at all.

ticker:*            articles tagged with at least one company
eventType:*         articles with at least one event
sourceType:*        articles from a classified source

* works on these fields only: source, sourceType, sentiment, ticker, companyId, exchange, sector, companyCountry, role, eventType, eventDirection, eventImportance. On the other text fields, * is taken as a literal value and matches nothing. On the number fields (relevance, eventConfidence, companyCount, eventCount) and on publishedAt it is a 400. Do not use * there. Partial wildcards such as Appl* are not supported.


Comparisons

Put >=, >, <= or < directly before the value.

relevance:>=0.8
eventConfidence:>0.9
eventImportance:>=high
companyCount:1
eventCount:>=2
publishedAt:>=2026-11-01
  • Comparisons work on relevance, eventConfidence, companyCount, eventCount, publishedAt and eventImportance. On any other field they are an error.
  • eventImportance has an order. From lowest to highest it is low, medium, high, critical. eventImportance:>=high matches high and critical.
  • A publishedAt condition is an extra filter. It does not replace from and to of the REST request, and your plan's date window still applies.

Value lists

To allow several values for one field, put them in round brackets after the colon.

ticker:(NVDA OR AMD OR INTC)
role:(acquirer target)
Apple AND -sourceType:(press_release blog)
  • This is short for (ticker:NVDA OR ticker:AMD OR ticker:INTC).
  • Values separated only by a space are joined with OR.
  • A - before the field excludes the whole list: Apple -sourceType:(press_release blog). An AND before it is allowed and changes nothing.
  • Value lists also work inside correlation groups.

Correlation groups

Curly braces say "these conditions are about the same company" or "the same event".

{ticker:NVDA AND role:subject}
{eventType:mna AND eventImportance:>=high}

Without braces, ticker:NVDA AND role:subject matches an article where NVIDIA is tagged and some company (maybe another one) has the role subject. With braces, NVIDIA itself must be the subject.

Groups can only contain field conditions on companies or events. The full rules are on Companies & Events.


Quoting text with a colon

In REST v3, a word with a colon is read as field:value. If the part before the colon is not a known field, the request fails. Put free text that contains a colon in double quotes.

"Breaking: Apple"      searches the phrase
Breaking:Apple         400 on REST v3, unknown field "Breaking"

Words that start with a digit, such as times like 10:30, are not read as fields and need no quotes.


Strict and lenient parsing

The grammar is shared, but the three channels treat an unknown field name differently.

ChannelUnknown field name, e.g. evenType:mnaOther query errors
REST v3 search400 VALIDATION_FAILED400 VALIDATION_FAILED
Enriched WebSocketSilently searched as free textconnection.error with code SEARCH_FAILED, then the connection closes
Raw WebSocketSilently searched as free textconnection.error with code SEARCH_FAILED, then the connection closes
Webhook criteria (enriched and raw)Silently searched as free textThe dashboard does not save the webhook and shows the error

"Other query errors" are the same everywhere: an unknown value of a fixed list (for example sourceType:wire), a comparison on a field that has no order, a broken correlation group, a query with only negated conditions, and the limits below.


Raw streams and raw webhooks

Raw articles are delivered before enrichment. They have no companies, events or sentiment. Conditions on those fields never match on raw channels, so a raw subscription with ticker:NVDA stays silent.

On raw channels use free text and the fields source, sourceType, title and summary.

title:Nvidia -source:www.example.com
sourceType:newswire AND (merger OR acquisition)

Chinese queries

When you search Chinese articles (REST languages containing a zh tag, or language zh on WebSocket and webhooks), Traditional Chinese characters in the query are converted to Simplified before the search. You can write either form.


Limits

LimitValue
Length of the query string20,000 characters
Tokens (words, operators, brackets)2,000
Terms (words, phrases and field conditions)2,000
Nesting depth100 levels, counting the query itself. That is 99 nested brackets

A query over a limit is rejected like any other query error.


Errors

On REST v3, a query error is a 400 VALIDATION_FAILED problem. The errors[].field names the kind of problem and errors[].issue holds the message.

fieldWhen
badQueryUnknown field, unknown value, comparison on a field without order, broken correlation group, unclosed brace
positiveTermRequiredEvery condition is negated
missingTermThe query has no usable term, for example only an empty phrase
complexityToo many tokens or terms, or nested too deeply
maxLengthThe query string is longer than 20,000 characters
sourcesA source: condition in the query and the sources request field are both set

Response 400

{
  "type": "https://docs.finlight.me/errors/validation-failed",
  "title": "Validation failed",
  "status": 400,
  "detail": "1 request field is not valid.",
  "code": "VALIDATION_FAILED",
  "requestId": "req_7f3c2a90-1b4e-4c55-9d0a-2f6e8b1c4d21",
  "errors": [
    {
      "field": "badQuery",
      "issue": "Unknown value \"wire\" for field \"sourceType\". Allowed values: newswire, press_release, financial_media, general_media, aggregator, blog, government"
    }
  ]
}

Branch on code and errors[].field, not on the message text. More about the error format on Errors and Validation failed. The exact messages of the common mistakes are on Examples.

A query that ends in an operator (Tesla AND) and a query that holds only spaces are rejected in the same way, with the messages Unexpected end of input and Query is empty.