Raw - Subscribe to articles

The Raw WebSocket provides a lightweight, streamlined alternative to the Enhanced WebSocket. It delivers core article data in real-time without ticker matching, AI enrichment, or company entity resolution. This makes it ideal for use cases where you need fast, basic article data without the overhead of advanced processing.


Article model

The Raw WebSocket returns a simplified article model with core fields only. No company entities or AI-generated enrichments are included.

  • Name
    link
    Type
    string
    Description

    URL to the full article.

  • Name
    source
    Type
    string
    Description

    Source website. E.g. www.reuters.com

  • Name
    title
    Type
    string
    Description

    Title of the article.

  • Name
    summary
    Type
    string
    Description

    Summary of the article if existing. Can be nullable.

  • Name
    publishDate
    Type
    Date
    Description

    Publication date as ISO date.

  • Name
    createdAt
    Type
    Date
    Description

    Internal creation date of the article in the finlight system as ISO date.

  • Name
    language
    Type
    string
    Description

    Language code in ISO 639-1. E.g. en | de | fr

  • Name
    images
    Type
    string[]
    Description

    Array of image URLs from the article.

  • Name
    countries
    Type
    string[]
    Description

    Array of country codes in ISO 3166-1 alpha-2 format representing the countries related to the article. E.g. ["US", "GB", "DE"]. Can be empty.

  • Name
    categories
    Type
    string[]
    Description

    Array of article categories. Possible values: markets | economy | business | politics | geopolitics | regulation | technology | energy | commodities | crypto | health | climate | security | irrelevant. Can be empty.


WEBSOCKET/raw

Fetch articles

After connecting, you will only receive newly published articles that match your criteria. No initial/historical article is sent on connection.

When subscribing, you can specify the following parameters to filter the articles you receive:

  • Name
    query
    Type
    string
    Description

    Search query to find relevant articles. Supports field-level filtering for source, title, and summary fields. Advanced queries

  • Name
    sources
    Type
    string[]
    Description

    Filter by single or multiple sources. E.g. ["www.reuters.com", "www.cnbc.com"]. See source endpoint for valid values.

  • Name
    excludeSources
    Type
    string[]
    Description

    Exclude single or multiple sources. E.g. ["www.reuters.com", "www.cnbc.com"]. See source endpoint for valid values.

  • Name
    language
    Type
    string
    Description

    Filter by language. Language code in ISO 639-1.

Request

WEBSOCKET
/raw
import { FinlightApi } from 'finlight-client'

const client = new FinlightApi(
  {
    apiKey: 'YOUR_API_KEY', // Replace with your API key
  },
  {
    takeover: true, // WebSocket options
  },
)

client.rawWebsocket.connect(
  {
    query: 'Nvidia',
    language: 'en',
    sources: ['www.reuters.com', 'www.cnbc.com'],
  },
  (article) => {
    console.log('New article received:', article)
  },
)

Response

{
  "link": "https://www.example.com/article1",
  "source": "www.example.com",
  "title": "Stock Market Hits New Highs",
  "summary": "A brief summary of the article...",
  "publishDate": "2023-10-01T12:34:56Z",
  "createdAt": "2023-10-01T12:35:10Z",
  "language": "en",
  "images": [
              "https://www.example.com/image1.jpg",
              "https://www.example.com/image2.jpg"
            ],
  "countries": ["US"],
  "categories": ["markets"]
}

Query Field-Level Filtering

The Raw WebSocket supports field-level filtering within the query parameter for the following fields:

  • source - Filter by article source
  • title - Filter by article title content
  • summary - Filter by article summary content

Examples:

query=title:Nvidia

Returns articles where the title contains "Nvidia".

query=summary:earnings +title:Tesla

Returns articles where the summary mentions "earnings" and the title contains "Tesla".

query=source:www.reuters.com -crypto

Returns articles from Reuters, excluding those mentioning "crypto".

See the Advanced Query Building guide for more details on query syntax.


Connection Behavior

  • Authentication: Uses the same x-api-key header as the Enhanced WebSocket. See WebSocket Basics for details.
  • Ping/Pong: The same keep-alive mechanism applies. Send periodic ping messages to maintain the connection.
  • Connection Duration: Subject to the same 2-hour connection limit. Implement reconnect logic accordingly.
  • No Initial Data: Unlike the Enhanced WebSocket, connecting or reconnecting does not return the latest matching article. Only newly published articles are delivered after connection.