Skip to content

SDKs · 21 languages

News API SDKs for Python, JavaScript, Java and 18 more languages

World News API SDKs come in 21 languages, generated from the OpenAPI spec and open source on GitHub: a Python news API client (pip install worldnewsapi), a JavaScript news API client on npm, TypeScript, Java and 17 more. Every news API SDK wraps the full news data API, from search and the news by country API to the news headline API and RSS feeds, so it doubles as a news feed SDK.

$ pip install worldnewsapiPyPI
import worldnewsapi

configuration = worldnewsapi.Configuration(
    api_key={"headerApiKey": "YOUR_API_KEY"}
)

with worldnewsapi.ApiClient(configuration) as api_client:
    news_api = worldnewsapi.NewsApi(api_client)
    response = news_api.search_news(
        text="electric vehicles",
        language="en",
        source_country="us",
    )
    for article in response.news:
        print(article.publish_date, article.title)
Published on PyPI as worldnewsapi. Python SDK on GitHub
SDK news All 21 clients were regenerated on March 19, 2025 for API version 2.2.0. API changelog

Download

All 21 official SDKs.

Each language links to its folder on GitHub, with a README and docs for every method, and to a zip you can drop into your project.

These libraries only work with direct World News API access, not with RapidAPI. If you use the API on RapidAPI, use their libraries for it.
Older clients from June 2024 (API version 1.2.0), as zip downloads only: Groovyzip Objective-Czip

Inside each SDK

The whole international news API in 9 methods.

Your key goes in once, as the apiKey query setting or the headerApiKey header setting. Method names follow each language's style, for example search_news() in Python and Ruby.

Your code search_news() SDK typed models api.worldnewsapi.com
  • searchNewsGET /search-newsSearch and filter news articles by text, entities, location, country, language, sentiment, category, source, author and publish date.
  • topNewsGET /top-newsGet the top headlines of a country and language for a given day, clustered by story.
  • retrieveNewspaperFrontPageGET /retrieve-front-pageGet the front page image of a newspaper by country, publication and date (6,000+ publications).
  • retrieveNewsArticlesByIdsGET /retrieve-newsRetrieve full news articles by their ids.
  • extractNewsGET /extract-newsExtract the title, text, images, authors and publish date of the article at any URL.
  • extractNewsLinksGET /extract-news-linksExtract the links to news articles from a news website, e.g. a homepage or section page.
  • searchNewsSourcesGET /search-news-sourcesCheck whether a news source is indexed, by name.
  • newsWebsiteToRSSFeedGET /feed.rssTurn any news website into an RSS feed.
  • getGeoCoordinatesGET /geo-coordinatesGet latitude and longitude of a location name, e.g. for the location-filter of Search News.
  • Suggest News Source (POST /suggest-news-source) is not in the SDKs yet; call it over plain REST.

Specs and tools

Language not listed? Generate it, or skip the SDK.

The same OpenAPI 3 file the SDKs are built from is yours to download, along with a Postman collection for trying every endpoint first, and an MCP server for AI clients.

OpenAPI 3 specification

Generate a client for any language, for example with OpenAPI Generator:

openapi-generator-cli generate -i world-news-api-openapi-3.json -g swift5 -o swift-client

Postman collection

Want to get started without downloading an SDK? Fork the collection into your Postman workspace, add your key and send any request.

Download the collection

Plain REST

Every endpoint is one HTTPS request, so any HTTP client works. The docs show each call in cURL, Python, JavaScript, Java, Go and C#.

curl 'https://api.worldnewsapi.com/top-news?source-country=us&language=en' -H 'x-api-key: YOUR_API_KEY'

MCP server

No code at all: plug real-time news into your AI assistant. The World News API MCP server runs locally (stdio) with your API key, so Claude Desktop, Cursor and other MCP clients can search news, read articles and cite sources.

  • Claude Desktop
  • Cursor
  • any local MCP client

SDK questions

Is there a Python library for the news API?

Yes: pip install worldnewsapi. The official Python news API client is on PyPI; create a worldnewsapi.NewsApi object and call search_news(). It is generated from the OpenAPI file. Plain requests calls work just as well; the Python guide shows both.

Does World News API have an npm package?

Yes: npm install worldnewsapi. The worldnewsapi package (version 2.2.0) is the JavaScript news API client; a TypeScript client is listed here too. Plain fetch works the same in any Node.js 18+ project, as the JavaScript guide shows.

Do the SDKs work with RapidAPI?

No. They only work with direct World News API access. RapidAPI has its own libraries for the World News API if you access it there.

Are the SDKs open source?

Yes. All clients are on GitHub in world-news-api-clients; look at the source or fork it. If your language is missing, generate a client from the OpenAPI 3 specification.