Libraries & SDKs

Official GNews API libraries for seamless integration. SDKs include comprehensive examples and production-ready patterns for rapid development.

Python logo

Python

gnews-io-python

pip install gnews-io-python

Works with

  • Django
  • FastAPI
  • Flask
TypeScript logo

TypeScript

@gnews-io/gnews-io-js

npm i @gnews-io/gnews-io-js

Works with

  • JavaScript
  • Node.js
  • React
  • Vue.js
PHP logo

PHP

gnews-io/gnews-io-php

composer require gnews-io/gnews-io-php

Works with

  • Laravel
  • Symfony

Power AI with MCP Server

Supercharge your AI projects with real-time, high-quality news content. Our MCP server makes it simple to feed your LLMs and AI apps with fresh articles, trusted sources, and structured data ready to use at scale.

Community
Contributions

Have an integration for an unlisted technology? The GNews Team welcomes community-contributed libraries and SDKs for showcase on this page. Submit your project through the form.

Send us your project!

Speedometer icon

Effortless API integration

Our wrappers handle authentication, requests, error handling and automatic retries. For Notion integrations, use the Note API Connector.

Speedometer icon

Consistent pattern

Whether you use Python, PHP or a modern JS framework, each SDK exposes clear methods and typed responses.

Speedometer icon

Production-ready

Each repository includes examples and tests, providing reliable templates for development and production.

FAQ

Create an account at gnews.io/register, confirm your email address, and your API key is waiting on your dashboard. It works immediately on the Free plan, no credit card required.

Call an endpoint over HTTPS with your API key and read the JSON response. For example: https://gnews.io/api/v4/search?q=example&lang=en&apikey=YOUR_API_KEY. You can also build and run requests without writing any code from the API Playground in your dashboard. The full parameter reference is in the documentation.

totalArticles is the number of articles matching your query; the response only contains one page of them. Raise max (up to the limit of your plan: 10 on Free, 25 on Essential, 50 on Business, 100 on Enterprise) and walk through the results with page. Pagination stops at 1,000 articles per query, so narrow the query with filters or a date range to go deeper.

Either add your key to the query string as apikey=YOUR_API_KEY, or send it in the X-Api-Key HTTP header. The header is the better choice on a server, as the key then stays out of logs and referrer headers. A missing or invalid key returns 401 Unauthorized.

The q parameter accepts up to 200 characters and supports quoted phrases for an exact match, AND, OR, NOT and parentheses for grouping. Two words separated by a space are combined with AND by default, and OR binds more tightly than AND, so use parentheses when you mix them. Remember to URL-encode the query. On the Search endpoint, in=title,description,content controls which fields are searched.

  • 400 - the request is malformed; check parameter names, values and query syntax.
  • 401 - the API key is missing or invalid.
  • 403 - your daily quota is used up; it resets at 00:00 UTC.
  • 429 - too many requests per second; throttle your calls or back off and retry.
  • 500 - an error on our side; retry shortly.
  • 503 - temporary maintenance; retry in a few minutes.

Yes: 1 request per second on the Free plan and 10 requests per second on every paid plan. Going over that returns 429 Too Many Requests, so spread out bursts or retry with exponential backoff.

Yes on any paid plan, where CORS is enabled for all origins. On the Free plan, CORS only allows localhost, so browser requests from a deployed site are blocked. Keep in mind that a key used in front-end code is visible to anyone, so for a public site it is safer to call the API from your own backend and forward the results.

No. It is a plain REST API over HTTPS, so any HTTP client works. The official libraries simply save you from writing the request building, authentication and error handling yourself.

A JavaScript/TypeScript package covering Node.js, React and Vue.js, and a PHP package that also works with Laravel. Both are listed with their install instructions on the Libraries & SDKs page.

Yes. Our MCP server exposes GNews API to LLMs and AI agents, so your assistant can search and read live news with structured results. It works with any MCP-compatible client and uses your normal API key.

Gladly. Send us the repository or package URL through the form on the Libraries & SDKs page. We review community projects and showcase the ones that are documented and maintained.

Looking for something else? See all frequently asked questions.

Ready to build
with the best news API?

Get your free API key and make your first request in minutes.