Subscribe
After you connect, send one subscribe message. It tells the server which articles you want and which blocks each article should carry. This page covers the enriched stream. The raw stream accepts fewer fields; see Raw stream.
Subscribe message
Send the subscribe message as a JSON text frame. It has no action key. It is a v3 subscribe only when payloadVersion is the JSON number 3.
Every field except payloadVersion is optional. Fields that you leave out do not filter.
- Name
payloadVersion- Type
- number
- Description
Must be
3. Without it, or with any other value (including the string"3"), the server treats the message as a v2 subscribe and sends v2 frames.
- Name
include- Type
- string[]
- Description
Extra blocks for each article:
companies,events. Default[]. A block appears only if your plan includes it; otherwise the key is absent and you get no error.sentimentneeds no include. See Plans & entitlements.
- Name
query- Type
- string
- Description
A search query, for example
ticker:AMD AND eventType:mna. See Query syntax. On WebSocket the query is lenient: an unknown field name is treated as plain text instead of an error. A known field with an unknown value, such assourceType:wire, is rejected.
- Name
sources- Type
- string[]
- Description
Only articles from these source domains, for example
["www.reuters.com"].["*"]means every source your plan can access. Withoutsourcesyou get the default sources, plus any custom sources granted to you. One limit applies to live frames: together with aquery,sourcesdoes not deliver a source that is neither a default source nor a custom source granted to you. The initial push can still show such a source, but the live frames do not. To follow such a source with other conditions, leavesourcesout and name the source in the query:source:www.example.com AND ticker:AMD.sourcestogether with asource:condition in the query is rejected withSEARCH_FAILED. A custom source that was not granted to you is never delivered, in the initial push or in live frames, whateversourcesor the query name. See Sources for the domains and for which sources you can use.
- Name
optInSources- Type
- string[]
- Description
Sources to add to the default sources. Cannot be combined with
sources. Today it only changes the initial push, not the live frames. To follow a non-default source live, name it in the query withsource:. Do not use anoptInSources:condition in the query of a subscription. In the initial push it works like this field. In live frames it does not add the source, and it can remove articles: you then get no live frames from custom sources granted to you, and none from a source named withsource:in the same query.
- Name
excludeSources- Type
- string[]
- Description
Source domains to leave out.
- Name
source- Type
- string
- Description
Deprecated. A single source domain. It only filters the initial push, not the live frames. Use
sources.
- Name
sourceTypes- Type
- string[]
- Description
Only articles whose source has one of these types:
newswire,press_release,financial_media,general_media,aggregator,blog,government. Articles from unclassified sources never match. See Source types.
- Name
excludeSourceTypes- Type
- string[]
- Description
Leave out articles whose source has one of these types. Same values as
sourceTypes. Articles from unclassified sources are kept.
- Name
language- Type
- string
- Description
One language as an ISO 639-1 code. Default
en. Unlike REST search, WebSocket takes one language, not a list. To follow several languages, open one connection per language.
- Name
tickers- Type
- string[]
- Description
Only articles that mention one of these tickers. Vendor notations such as
000660.KSorKRX:000660are understood. An exchange in the notation must be the primary listing; for a secondary listing useticker:SYMBOL@MICin the query. See Tickers & exchanges.
- Name
countries- Type
- string[]
- Description
Only articles about one of these countries, as ISO 3166-1 alpha-2 codes, for example
["US", "DE"]. This matches the article'scountriesfield.
- Name
categories- Type
- string[]
- Description
Only articles in one of these categories, for example
["markets", "technology"].
- Name
includeUpdates- Type
- boolean
- Description
Also send
article.updatedwhen the title or summary of a matching article changes. Defaultfalse: without it you never receive updates.
- Name
clientNonce- Type
- string
- Description
A value of your choice. The server echoes it in
connection.admitted, so you can match the answer to your message.
There are no flat filters for roles, events, relevance, sectors or exchanges on WebSocket. Use the query for those, for example {role:target ticker:AMD} or eventImportance:>=high. See Companies & events.
Subscribe
{
"payloadVersion": 3,
"include": ["companies", "events"],
"query": "ticker:AMD AND eventType:mna",
"language": "en",
"excludeSourceTypes": ["aggregator", "blog"],
"includeUpdates": true,
"clientNonce": "c-42"
}
First frames
{"event":"connection.admitted","payloadVersion":3,"data":{"leaseId":"00000000-0000-4000-8000-00000000feed","serverNow":1795467845123,"clientNonce":"c-42"}}
{"event":"article.created","payloadVersion":3,"data":{"id":"pXhK9f2aQ1mZ0bT7cY3rLw","title":"AMD to buy ZT Systems","companies":[{"companyId":13,"name":"Advanced Micro Devices, Inc.","role":"acquirer","relevance":0.95}],"events":[{"type":"mna","direction":"positive","importance":"high","confidence":0.9,"companyIds":[13]}]}}
Keys that are not allowed
The v2 switches includeEntities and extended are forbidden in a v3 subscribe. Use include instead. If one of them is present, the server answers with VALIDATION_FAILED and closes the connection:
connection.error
{
"event": "connection.error",
"payloadVersion": 3,
"data": {
"code": "VALIDATION_FAILED",
"message": "Invalid subscription message",
"details": [{ "field": "includeEntities", "constraints": { "v3": "use include with payloadVersion 3" } }]
}
}
Any other key the server does not know is dropped without an error. A misspelled field name therefore does not filter. The client libraries check field names before they send.
Validation errors
The server checks the types and the closed lists of values. On any problem it sends VALIDATION_FAILED and closes the connection. Fix the message before you reconnect; sending it again gives the same error.
Each entry in details names the field and the broken rule in constraints. For include, sourceTypes and excludeSourceTypes it also lists allowedValues:
Unknown source type
{
"event": "connection.error",
"payloadVersion": 3,
"data": {
"code": "VALIDATION_FAILED",
"message": "Invalid subscription message",
"details": [
{
"field": "sourceTypes",
"constraints": {
"isIn": "each value in sourceTypes must be one of the following values: newswire, press_release, financial_media, general_media, aggregator, blog, government"
},
"allowedValues": ["newswire", "press_release", "financial_media", "general_media", "aggregator", "blog", "government"]
}
]
}
}
Problems in the query or in the source fields show up one step later, when the server runs the first search. Then the code is SEARCH_FAILED and the connection is closed, too. Two examples:
| Subscribe | message |
|---|---|
"query": "sourceType:wire" | Unknown value "wire" for field "sourceType". Allowed values: newswire, press_release, financial_media, general_media, aggregator, blog, government |
"sources" and "optInSources" together | Can't have optInSources and sources defined simultaneously |
SEARCH_FAILED can also mean a short outage of the search. The client libraries therefore reconnect on it and report it after 5 failures in a row. If you see it every time, check your query. See Frames for every error code.
What happens after you subscribe
The server handles each subscribe message in this order:
- If the message is not valid JSON, the server answers with an error in the v2 form (
{"action":"error","data":"Message processing failed"}), because it cannot read the version. The connection stays open. - If the message looks like a ping (
"type": "ping"or"action": "ping"that reached the wrong route), the answer is an error that says "Ping messages should be sent to the ping route". It isconnection.errorwith codePING_ON_DEFAULT_ROUTEwhen the message carries"payloadVersion": 3, otherwise the v2 form{"action":"error","error":"..."}. The connection stays open. - On the first subscribe of a connection the server sends
connection.admitted. This happens before validation, so it does not mean your subscribe was accepted. - The server validates the message. On failure:
VALIDATION_FAILED, then the connection is closed. - The server searches for the newest matching article and sends it as
article.created(the initial push). On failure:SEARCH_FAILED, then the connection is closed. If nothing matches, nothing is sent. - The subscription is stored. From now on, new matches arrive as
article.createdand, withincludeUpdates, changes asarticle.updated.
Changing the subscription
Send a new subscribe message on the same connection. It replaces the old one completely. The server runs the initial push again, so you get the newest matching article for the new filters.
connection.admitted is sent again only when the new message carries the same clientNonce as the first one. With a new nonce, or none, there is no second connection.admitted. That is not an error.
Initial push
Right after a valid subscribe, the enriched stream sends one article: the newest matching article by the time finlight first saw it. It arrives as a normal article.created frame.
- It can be old, for example when your filters match rarely.
- It is sent again after every subscribe, so also after every reconnect and rotation. Drop it if you already have it.
- It uses the plan you had when the connection was opened.
- It stays inside your plan's date window. With a delay in your plan, it is the newest matching article that is older than the delay.
The raw stream has no initial push.