Best News API for JavaScript & Node.js 2026 (+TS + SSE)

Erick Horn

Erick Horn

·

23 mins ler

Best News API for JavaScript & Node.js 2026 (+TS + SSE)

Best News API for JavaScript / Node.js Projects in 2026 (with TypeScript, Fetch, and SSE)

Most "best news API for Node.js" articles on the first page of Google were written before Node 18 shipped with a native fetch. Many of them still open with npm install node-fetch and a require call. This one won't.

Disclosure. APITube publishes this blog. APITube is one of the APIs listed below. Every code sample runs as written; every vendor fact comes from the vendor's public docs as of 2026-04-15.

Heads up: If you are on Node 18 or later, you no longer need node-fetch. The global fetch, Response, Headers, and Request are built in. All examples below use the native one. Anything you find online that starts with require('node-fetch') was probably written for Node 16, which has been out of LTS since 2023.

TL;DR — the best news API for JavaScript / Node.js in 2026

The best news API for JavaScript and Node.js in 2026 is the one that speaks clean REST with header auth, returns a typed JSON shape you can zod-parse, works in Node 18+ and at the edge, and doesn't force a stale npm SDK on you. On that definition, APITube, NewsData.io, and Perigon lead; NewsAPI.org trails because of its ?apiKey= query-param auth and production-only paywall.

Quick picks:

RankAPInpm packageAuth styleTS-friendlyEdge-runtime safeStreaming
1APITubenone (use native fetch)X-API-Key headerYes (BYO types)YesSSE
2NewsData.ionone (use native fetch)header / queryYes (BYO types)YesNo
3Perigonnone (use native fetch)headerYes (BYO types)YesNo
4NewsAPI.orgnewsapi (unofficial)?apiKey= queryPartial (unofficial types)Package onlyNo
5Event Registryevent-registry-node-jsheaderPartialNo (Node-only SDK)No
6GNewsnone (use native fetch)query paramYes (BYO types)YesNo
7NewsFilterfinancial-news-apiheaderPartialPartialYes (financial stream)

The rest of this post is a per-vendor walkthrough, a single reusable TypeScript client that works across any of them, an SSE streaming example in Node, and the production notes (429 handling, key-in-URL leakage, Express proxy, edge compatibility) that nobody else on the SERP covers.

This article is for you if

You are a JavaScript or TypeScript developer picking a news API for a real project — a Node backend, a Next.js API route, a Cloudflare Worker, a Deno service, or a Vercel Edge function. You want runnable code, not more blurbs. You want to know which SDKs will still work in two years and which will not.

Table of contents

1. APITube

Install: none — use native fetch (Node 18+).Auth:X-API-Key header.Endpoint:/v1/news/everything. Response includes sentiment, entities, categories, and summary per article. Supports text/event-stream for SSE.

const res = await fetch(
  "https://api.apitube.io/v1/news/everything?title=openai&language.code=en&per_page=3",
  { headers: { "X-API-Key": process.env.APITUBE_KEY! } }
);
const data = await res.json();
for (const a of data.results) console.log(a.title, a.sentiment.overall.polarity);

Quirks: no official SDK — that is the point. A clean REST surface + header auth works identically in Node 18+, Deno, Bun, Cloudflare Workers, and Vercel Edge. BYO types via zod or hand-written interfaces.Pick when: you want one vendor that works in every runtime, you want sentiment and entities without a second NLP service, and you dislike being locked into someone else's npm package.

2. NewsData.io

Install: none — native fetch.Auth:apikey query or header.Sources: 87,000+ across 206 countries, 89 languages.

const res = await fetch(
  `https://newsdata.io/api/1/latest?q=openai&language=en&apikey=${process.env.NEWSDATA_KEY}`
);
const data = await res.json();
for (const a of data.results) console.log(a.title, a.source_id);

Quirks: query-param auth is convenient but leaks keys into server access logs. Swap to header auth for anything past a prototype. No official Node SDK.Pick when: you need the widest possible source coverage and are comfortable writing types.

3. Perigon

Install: none — native fetch.Auth:apiKey header.Focus: AI-first: clusters articles into events, ships named entities, offers vector embeddings.

const res = await fetch(
  "https://api.goperigon.com/v1/all?q=openai&language=en",
  { headers: { "x-api-key": process.env.PERIGON_KEY! } }
);
const data = await res.json();
for (const a of data.articles) console.log(a.title, a.entities?.length ?? 0);

Quirks: richer response schema than most, which is an advantage for LLM pipelines and a slight maintenance cost if you're typing every field yourself.Pick when: you are building an agent or retrieval pipeline and want clusters and entities out of the box.

4. NewsAPI.org

Install:npm install newsapi (unofficial) — or use native fetch.Auth:?apiKey= query parameter (the main drawback).License: the Developer plan is dev-only; production starts at $449/month. See our NewsAPI.org migration guide for the full story.

// using native fetch (no SDK needed)
const url = new URL("https://newsapi.org/v2/everything");
url.searchParams.set("q", "openai");
url.searchParams.set("apiKey", process.env.NEWSAPI_KEY!);
const res = await fetch(url);
const data = await res.json();

Quirks: the ?apiKey= pattern puts your secret into every server access log, upstream proxy log, and any error-tracking payload that includes request URLs. It's a well-known secret-leakage vector. The newsapi npm package is maintained by a volunteer and does not always track new endpoints promptly.Pick when: you are prototyping on localhost and need the biggest brand recognition for a resume line. For anything shipping, see the alternatives above.

5. Event Registry

Install:npm install eventregistry (official Node package).Auth: header.

import { EventRegistry, QueryArticlesIter } from "eventregistry";
const er = new EventRegistry({ apiKey: process.env.EVENTREGISTRY_KEY! });
const iter = new QueryArticlesIter(er, { keywords: "openai", lang: "eng" });
await iter.execQuery((a) => console.log(a.title));

Quirks: this is one of the few truly official Node SDKs, which feels good until you try to run it in a Cloudflare Worker or Vercel Edge function — the package relies on http/https modules that edge runtimes do not ship. Fine in a traditional Node server, problematic everywhere else.Pick when: you need the academic-research slant (events, concepts, sentiment) and you are running on plain Node, not edge.

6. GNews

Install: none — native fetch.Auth:apikey query parameter.

const res = await fetch(
  `https://gnews.io/api/v4/search?q=openai&lang=en&apikey=${process.env.GNEWS_KEY}`
);
const data = await res.json();
for (const a of data.articles) console.log(a.title);

Quirks: same key-in-URL issue as NewsAPI.org. Coverage is narrower (~60k sources).Pick when: you are on a strict budget ($40/mo paid tier) and your keyword set is English-heavy.

7. NewsFilter

Install:npm install financial-news-api.Auth: header.Focus: financial news; WebSocket streaming support.

import { NewsApiClient } from "financial-news-api";
const client = new NewsApiClient(process.env.NEWSFILTER_KEY!);
client.on("data", (article) => console.log(article.title));
client.connect({ query: { tickers: "AAPL" } });

Quirks: financial-vertical only; not suitable for general news. Streaming works well for that use case.Pick when: you are building a trading or compliance product and only care about financial news.

A reusable TypeScript news client

Most "best news API" articles stop at individual snippets. Here is a single TypeScript client that wraps any of the above REST APIs behind one interface. It handles retries, 429 rate-limiting with exponential backoff, and a typed response via generics.

type FetchOpts = { retries?: number; backoffMs?: number };

export async function safeFetchJson<T>(
  url: string,
  init: RequestInit = {},
  opts: FetchOpts = {}
): Promise<T> {
  const { retries = 3, backoffMs = 500 } = opts;
  for (let attempt = 0; attempt <= retries; attempt++) {
    const res = await fetch(url, init);
    if (res.status === 429 || res.status >= 500) {
      if (attempt === retries) throw new Error(`HTTP ${res.status} after ${retries} retries`);
      const retryAfter = Number(res.headers.get("retry-after")) * 1000 || backoffMs * 2 ** attempt;
      await new Promise((r) => setTimeout(r, retryAfter));
      continue;
    }
    if (!res.ok) throw new Error(`HTTP ${res.status}: ${await res.text()}`);
    return (await res.json()) as T;
  }
  throw new Error("unreachable");
}

export interface NewsArticle { title: string; url: string; publishedAt: string; source?: string; }
export interface NewsClient { search(query: string, lang?: string): Promise<NewsArticle[]>; }

export function apitubeClient(key: string): NewsClient {
  return {
    async search(query, lang = "en") {
      const u = new URL("https://api.apitube.io/v1/news/everything");
      u.searchParams.set("title", query);
      u.searchParams.set("language.code", lang);
      u.searchParams.set("per_page", "20");
      const data = await safeFetchJson<{ results: any[] }>(u.toString(), {
        headers: { "X-API-Key": key },
      });
      return data.results.map((a) => ({
        title: a.title, url: a.href, publishedAt: a.published_at, source: a.source?.domain,
      }));
    },
  };
}

// Same pattern for NewsData.io, Perigon, GNews — different query shape + field mapping only.

Call it the same way regardless of vendor:

const client = apitubeClient(process.env.APITUBE_KEY!);
const articles = await client.search("openai", "en");

Swap apitubeClient for newsdataClient or perigonClient of the same shape and the rest of your app does not change. That is the layer every tutorial on the first page of Google should have but doesn't.

Streaming news with SSE in Node.js

Most vendors ship REST only. A few — APITube among them — expose text/event-stream for real-time delivery. Consuming SSE in Node 18+ takes about fifteen lines:

const res = await fetch("https://api.apitube.io/v1/news/stream?language.code=en", {
  headers: { "X-API-Key": process.env.APITUBE_KEY!, "Accept": "text/event-stream" },
});
if (!res.body) throw new Error("no body");

const reader = res.body.pipeThrough(new TextDecoderStream()).getReader();
let buf = "";
while (true) {
  const { value, done } = await reader.read();
  if (done) break;
  buf += value;
  const lines = buf.split("\n\n");
  buf = lines.pop() ?? "";
  for (const chunk of lines) {
    const dataLine = chunk.split("\n").find((l) => l.startsWith("data: "));
    if (dataLine) {
      const article = JSON.parse(dataLine.slice(6));
      console.log(new Date().toISOString(), article.title);
    }
  }
}

That is it. No eventsource package, no node-fetch shim, no polyfills. Add a keep-alive ping and reconnect loop for production and you have a live news feed.

Shipping to production without getting paged

The tutorials on Dev.to stop at the hello-world. Here are the four things that catch teams in week two.

1. Never put API keys in query strings. URLs end up in access logs, upstream proxy logs, APM tools, and error-tracking payloads. A key in a query string is a key in three dozen places you forgot. When a vendor offers only query-string auth (NewsAPI.org, GNews), proxy the call through your own backend and strip the key from logged URLs.

2. Handle 429 properly. The safeFetchJson wrapper above respects Retry-After and exponential backoff. If your vendor doesn't send Retry-After, default to 2^attempt * 500ms. Log the retry count as a metric — if you hit retries often, you've outgrown the tier.

3. Use an Express proxy for browser clients. Never call a news API directly from browser JavaScript. A tiny Express route keeps the key server-side:

import express from "express";
import { apitubeClient } from "./news";
const app = express();
const client = apitubeClient(process.env.APITUBE_KEY!);
app.get("/api/news", async (req, res) => {
  const articles = await client.search(String(req.query.q ?? "news"));
  res.json(articles);
});
app.listen(3000);

4. Verify edge-runtime compatibility. Cloudflare Workers, Vercel Edge, and Deno Deploy ship web-standard fetch but no http, https, or Buffer. Any npm SDK that imports those breaks. Clean REST vendors (APITube, NewsData, Perigon, GNews) run identically everywhere; Node-only SDKs (Event Registry's) do not. Test early in the runtime you will actually deploy to.

What is changing for JS devs in 2026-2027

Three shifts make the news-API choice more consequential for JavaScript shops specifically:

  1. Node is the default LLM-agent backend. Agents built with Vercel AI SDK, Mastra, LangGraph.js, and their peers are increasingly Node-shaped and pull news as a retrieval tool. Vendors shipping sentiment and entities per article let the agent skip an NLP step. Vendors that don't force you to add a second service to your stack.

  2. Edge runtimes are pruning Node-specific SDKs. As more teams deploy to Cloudflare Workers and Vercel Edge for latency, Node-only npm packages become a liability. Unlike a vendor-specific SDK, a clean REST + header-auth API works unchanged in every runtime, which means the vendor with the thinnest SDK surface often wins.

  3. node-fetch is heading out the door. Many popular news SDKs still pin old node-fetch versions as transitive dependencies. As Node 22 and 24 tighten module resolution and ESM behavior, those pins become upgrade blockers. A one-line native fetch call today is a future-proof choice; a 2023-vintage SDK is a future migration.

Frequently asked questions

Which news API works best with Node.js?

The news API that works best with Node.js in 2026 is APITube, NewsData.io, or Perigon, because each one speaks clean REST with header auth and works unchanged with Node 18+'s built-in fetch plus edge runtimes like Cloudflare Workers and Vercel Edge. NewsAPI.org works too but its query-param auth leaks keys into logs.

Is there a news API npm package?

Yes, there are news API npm packages — newsapi (unofficial NewsAPI.org client), eventregistry (official Event Registry SDK), and financial-news-api (NewsFilter). For most 2026 production projects, skip the SDKs and call REST directly with Node 18's native fetch, because it ships better edge-runtime compatibility and avoids stale node-fetch pins.

How do I use News API in Express?

To use a news API in Express, create a route that calls the vendor from the server side, never from the browser, to keep the API key secure. A typical route does app.get("/api/news", async (req, res) => { const data = await fetch(...); res.json(await data.json()); }). This proxy pattern keeps credentials server-side and lets you cache or rate-limit.

Does News API have TypeScript types?

Most news APIs in 2026 do not ship official TypeScript types; you define them yourself with a response interface or parse the response with zod. A typed fetch wrapper (see the reusable client above) plus a per-vendor mapper function is the cleanest pattern. Unofficial @types/newsapi exists on DefinitelyTyped but lags the real schema.

How do I stream news in Node.js?

To stream news in Node.js, use a news API that exposes text/event-stream (APITube is one of the few). Call fetch() with Accept: text/event-stream, pipe the response body through a TextDecoderStream, split chunks on \n\n, and parse each data: line as JSON. Node 18+ handles this with no npm dependency — about fifteen lines of code total.

Verdict

The best news API for JavaScript and Node.js in 2026 is the one that treats your runtime as a web-standard environment, not a Node-only one. APITube, NewsData.io, and Perigon all qualify; NewsAPI.org's query-string auth and production paywall keep it out of the top tier; Event Registry's official SDK is a trap if you ever deploy to the edge. Build a small typed wrapper, keep keys server-side, use the native fetch, and you will be future-proofed against the next four LTS bumps.

APITube ships a clean REST API that works with Node 18+ native fetch, edge runtimes, and SSE streaming. 30 requests / 30 minutes on the free tier, commercial use allowed, sentiment and entities on every article. apitube.io

Related reading: Best News API in 2026: Complete Comparison Guide · NewsAPI.org vs APITube: migration in an afternoon · MDN: Fetch API

Resources

Related guides:

APITube - News API

Artigos relacionados

News API Quick Start: Your First Request in 5 Minutes
Developer Guides

News API Quick Start: Your First Request in 5 Minutes

Hit a real news API endpoint in 5 minutes — curl, JavaScript, and Python side by side, with an annotated JSON response and fixes for the 401/429 errors you'll actually hit.

React News Dashboard Tutorial 2026: SSE + TypeScript
Developer Guides

React News Dashboard Tutorial 2026: SSE + TypeScript

Build a real-time React news dashboard with TypeScript and Server-Sent Events. Full code, 429-safe fetch hook, sentiment filters, Vercel deploy.

Best News API Python 2026: 6 Options with Code
Insights

Best News API Python 2026: 6 Options with Code

Best news API for Python in 2026: six ranked options with runnable code, asyncio.gather across vendors, pandas pipeline, and tenacity retry.

News API Buyer's Guide 2026: 6 Providers Scored
Insights

News API Buyer's Guide 2026: 6 Providers Scored

Score 6 news API providers on 8 weighted criteria. Working code, cost modeling at 3 tiers, and a decision checklist. No vendor bias. Updated 2026.

Utilizamos cookies

Ao clicar em "aceitar", concorda com o armazenamento de cookies no seu dispositivo para fins funcionais e analíticos.