LogoRHub

Search for news articles that mention a specific topic or keyword

The main use of our News API is to search through every article published by a wide range of news sources and blogs in recent years.

Use the /api/everything. endpoint. Both GET and POST are supported.

See the endpoint reference below.

Authentication

Provide your API key via the apikey query parameter.

Endpoint: GET/POST /api/everything

Parameters
  • qkeyword or phrase (Free: required; Pro: optional)
  • apikeyyour API key (required, query param)
  • categoryfilter by category (Pro)
  • sourcefilter by source/domain (Pro)
  • pagepage number (default 1)
  • pageSizeresults per page
Pro users may provide any combination of q, category, source; at least one of them is required for Pro requests.
Free vs Pro
  • Free: initial 100 requests; can increase by watching ads.
  • Free: results delayed by several hours (not realtime).
  • Free: limited set of sources.
  • Pro: realtime results, full source coverage, category/source filters, higher limits, Socket realtime supported.

Get curated breaking news headlines

Use the headlines endpoint for fast access to trending news.

Realtime stream (WebSocket) — Pro

Production URL matches the public API prefix: wss://rhubapi.org/api/ws/everything?apikey=… — path is /api/ws/everything (not the same as HTTP /api/everything). For a bare Go API without an /api reverse-proxy prefix, use ws://host:port/ws/everything?apikey=…

Pro users can subscribe to realtime updates via WebSocket. Authenticate with apikey (query param).

Behavior

Long-lived stream (always):

  • Optional q (keyword)If you pass q, only new inserts whose title, authors, content, or tags contain q (case-insensitive) are pushed. The connection stays open so future matching rows are pushed too.
  • Optional category / sourcecategory and source further narrow matches (AND with q and each other). If you omit q, category, and source, every new article is pushed. Each push is { "type": "article", "data": { ... } }.
  • The server first sends { "type": "subscribed", "q", "category", "source" }. Use HTTP GET /everything for paginated historical search; WebSocket is for realtime inserts only.
Access control
  • WebSocket streaming is available to Pro users only.
  • Free users receive delayed, non‑realtime results via the HTTP endpoint instead.
Endpoint
Example: q + category + source (long-lived)
wss://rhubapi.org/api/ws/everything?apikey=YOUR_API_KEY&q=openai&category=technology&source=nytimes.com
Example: category + source only (long-lived)
wss://rhubapi.org/api/ws/everything?apikey=YOUR_API_KEY&category=technology&source=nytimes.com
Example: apikey only — all new articles
wss://rhubapi.org/api/ws/everything?apikey=YOUR_API_KEY
Params: HTTP GET /api/everything: at least one of q, category, or source is required. WebSocket /api/ws/everything: long-lived; optional q, category, and source use AND semantics; omit all three to receive every new row. WebSocket ignores page and pageSize (those apply to HTTP GET /api/everything only). First WebSocket message is subscribed; then article messages for each matching insert.
JavaScript example
// Long-lived stream: first frame { type: "subscribed", ... }, then { type: "article", data } per matching insert.
// Path must be /api/ws/everything (same /api prefix as HTTP /api/everything). Optional q/category/source (AND); omit all three = every new insert.
// Historical pagination: HTTP GET https://rhubapi.org/api/everything?apikey=...&q=...
const url = new URL("wss://rhubapi.org/api/ws/everything");
url.searchParams.set("apikey", "YOUR_API_KEY");
url.searchParams.set("q", "openai");
url.searchParams.set("category", "technology");
url.searchParams.set("source", "nytimes.com");

let socket;
let attempts = 0;
function connect() {
  socket = new WebSocket(url.toString());
  socket.onopen = () => {
    attempts = 0;
    console.log("connected");
  };
  socket.onmessage = (ev) => {
    try {
      const msg = JSON.parse(ev.data);
      // { type: "subscribed", q, category, source }
      // { type: "article", data: {...} }
      console.log("message:", msg);
    } catch {
      console.log("raw:", ev.data);
    }
  };
  socket.onclose = () => {
    // simple backoff
    const wait = Math.min(30000, 1000 * Math.pow(2, attempts++));
    setTimeout(connect, wait);
  };
  socket.onerror = (e) => console.error("ws error", e);
}
connect();
Message format
First message (ack):
{
  "type": "subscribed",
  "q": "openai",
  "category": "technology",
  "source": "nytimes.com"
}
Each matching insert:
{
  "type": "article",
  "data": {
    "id": "aHR0cHM6Ly9kZW5vbmJ1LmpwL2RldGFpbC85LzEwNzk=",
    "url": "https://example.com/article",
    "title": "xxxxxxxxxxxxx",
    "authors": null,
    "language": "zh",
    "content": "xxxxxxxxxxxxx",
    "date_published": "2025-11-27T03:57:57.000Z"
  }
}
Free users do not have realtime access; their results are delayed by several hours and limited to a subset of sources.

Node.js client

Installation
# Option A: Node 18+ (built-in fetch) → no install
# Option B: axios
npm install axios --save
Usage
// Node 18+ (built-in fetch)
const url = "https://rhubapi.org/api/everything?q=openai&apikey=YOUR_API_KEY&page=1&pageSize=10";
const res = await fetch(url);
const data = await res.json();
console.log(data);

// Or axios
/*
import axios from "axios";
const res = await axios.get("https://rhubapi.org/api/everything", {
  params: { q: "openai", apikey: "YOUR_API_KEY", page: 1, pageSize: 10 }
});
console.log(res.data);
*/

Python client

Installation
pip install requests
Usage
import requests

url = "https://rhubapi.org/api/everything"
params = {"q": "openai", "apikey": "YOUR_API_KEY", "page": 1, "pageSize": 10}
r = requests.get(url, params=params, timeout=15)
r.raise_for_status()
print(r.json())

Ruby client

Installation
# Uses Ruby stdlib (net/http). No extra install required.
Usage
require "net/http"
require "json"

uri = URI("https://rhubapi.org/api/everything")
uri.query = URI.encode_www_form(q: "openai", apikey: "YOUR_API_KEY", page: 1, pageSize: 10)
res = Net::HTTP.get_response(uri)
puts JSON.parse(res.body)

PHP client

Installation
# Uses built-in functions. No extra install required.
Usage
<?php
$url = "https://rhubapi.org/api/everything?q=openai&apikey=YOUR_API_KEY&page=1&pageSize=10";
$resp = file_get_contents($url);
echo $resp;

Java client

Installation
# Uses Java 11+ HttpClient. No extra install required.
Usage
import java.net.http.*;
import java.net.URI;

HttpClient client = HttpClient.newHttpClient();
HttpRequest req = HttpRequest.newBuilder()
  .uri(URI.create("https://rhubapi.org/api/everything?q=openai&apikey=YOUR_API_KEY&page=1&pageSize=10"))
  .build();
HttpResponse<String> resp = client.send(req, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.body());

C# client

Installation
# Uses System.Net.Http.HttpClient (built-in). No extra install required.
Usage
using System.Net.Http;
using System.Threading.Tasks;

var http = new HttpClient();
var url = "https://rhubapi.org/api/everything?q=openai&apikey=YOUR_API_KEY&page=1&pageSize=10";
var resp = await http.GetStringAsync(url);
System.Console.WriteLine(resp);