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:
- Fields: every field you can use, with its values.
- Companies & Events: roles, events and correlation groups.
- Tickers & Exchanges: ticker notations, exchanges and identifiers.
- Examples: ready-made queries and common errors.
Where you use a query
The query is one string. You send it in the query field of:
- REST: the body of
POST /v3/articles/search. - WebSocket: the subscribe message of an enriched or raw stream.
- Webhooks: the query of the webhook criteria, set in the dashboard. See Criteria.
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
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
| Operator | Meaning | Example |
|---|---|---|
| space | All terms must match (same as AND) | Tesla recall |
AND | Both sides must match | Tesla AND recall |
OR | Either side must match | Tesla OR Rivian |
AND NOT | The next term or group must not match. NOT alone means the same | Tesla AND NOT China |
- | Same as AND NOT, written directly before a word, a phrase or a field condition. Not before a bracket | Tesla -China |
+ | Marks a term as required. This is the default, so + changes nothing | +Tesla recall |
Rules:
- Operators are not case sensitive:
and,orandnotwork too. This also holds in a plain-text query:Fed will not cut ratesexcludes every article that has the wordcut. To search for the words themselves, put them in quotes:Fed "will not cut" rates. NOTbinds tightest, thenAND, thenOR. Soa OR b cmeansa OR (b AND c).NOTwithout an operator before it meansAND NOT.Tesla NOT China,Tesla AND NOT ChinaandTesla -Chinaexclude the same articles. This also holds inside a bracket.- A query needs at least one condition that is not negated.
-cryptoalone, orNOT eventType:*alone, is rejected. Add a positive condition, for examplebitcoin -cryptoorticker: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:NVDAandticker : NVDAboth work. - Values are case sensitive, with two exceptions:
tickerandexchangevalues are converted to upper case for you. This does not apply to theSYMBOL@MICform: writeticker:NVDA@XNAS, notticker:nvda@xnas.role:Targetis an error,role:targetis right. - A value is one word. To match a multi-word value such as the sector
Real Estate, use the flatsectorsfilter of REST search. Writingsector:"Real Estate"does not filter on the sector: it is read as the textsector: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,publishedAtandeventImportance. On any other field they are an error. eventImportancehas an order. From lowest to highest it islow,medium,high,critical.eventImportance:>=highmatcheshighandcritical.- A
publishedAtcondition is an extra filter. It does not replacefromandtoof 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). AnANDbefore 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.
| Channel | Unknown field name, e.g. evenType:mna | Other query errors |
|---|---|---|
| REST v3 search | 400 VALIDATION_FAILED | 400 VALIDATION_FAILED |
| Enriched WebSocket | Silently searched as free text | connection.error with code SEARCH_FAILED, then the connection closes |
| Raw WebSocket | Silently searched as free text | connection.error with code SEARCH_FAILED, then the connection closes |
| Webhook criteria (enriched and raw) | Silently searched as free text | The 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.
On WebSocket and webhooks a typo in a field name does not fail. evenType:mna then searches for the text "evenType:mna" and usually matches nothing. Test a new query with REST v3 search first: it reports the typo.
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
| Limit | Value |
|---|---|
| Length of the query string | 20,000 characters |
| Tokens (words, operators, brackets) | 2,000 |
| Terms (words, phrases and field conditions) | 2,000 |
| Nesting depth | 100 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.
field | When |
|---|---|
badQuery | Unknown field, unknown value, comparison on a field without order, broken correlation group, unclosed brace |
positiveTermRequired | Every condition is negated |
missingTerm | The query has no usable term, for example only an empty phrase |
complexity | Too many tokens or terms, or nested too deeply |
maxLength | The query string is longer than 20,000 characters |
sources | A 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.