Real-time news stream (WebSocket)
WebSocket endpoint — described here as its HTTP handshake because OpenAPI cannot model WebSocket traffic. Connect with a WebSocket client:
wss://ws.newsdata.io/ws/event?apikey=YOUR_API_KEY®istration_id=YOUR_REGISTRATION_ID
Whenever newly collected articles match the registered query, the server pushes one JSON message per batch: {"status": "success", "totalResults": N, "results": [ ... ]}, where each result is an article in the same shape as /1/latest results. Fields listed in the registration's excludefield are left out, and pubDate/fetched_at are rendered in the registration's timezone (UTC otherwise; pubDateTZ names the zone). Client-to-server messages are ignored — the socket is receive-only.
The handshake itself is always accepted; on failure the socket is then immediately closed with WebSocket close code 1008 and a reason: invalid credentials or registration not found (bad apikey/registration_id, or the plan lacks WebSocket access), api limit reached (no API credits remaining), or device limit reached (more than the allowed simultaneous devices per registration_id — default 5). Each delivered article consumes 1 API credit per connected device; when the credits run out, open connections are closed with code 1008 (api limit reached). A client that reads too slowly is disconnected with code 1013 (send timeout).
Query parameters
Your API key, passed as a query-string parameter. This endpoint does not accept the X-ACCESS-KEY header.
The registration_id returned by /1/websocket/register (32-character identifier).