Libraries & SDKs
Official SDKs for Python, JavaScript/TypeScript, and PHP, plus LangChain tools. Each one handles authentication, errors, retries, and response parsing for you.
Python
gnews-io-python
pip install gnews-io-python
Works with
-
Django
-
FastAPI
-
Flask
JavaScript/TypeScript
@gnews-io/gnews-io-js
npm install @gnews-io/gnews-io-js
Works with
-
JavaScript
-
Node.js
-
React
-
Vue.js
PHP
gnews-io/gnews-io-php
composer require gnews-io/gnews-io-php
Works with
-
Laravel
-
Symfony
LangChain
langchain-gnews
pip install langchain-gnews
Works with
-
LangGraph
-
Python
Bring news into AI apps with the MCP server
The hosted MCP server gives AI assistants and agents structured articles from 80,000+ sources, with your API key. There's nothing to install.
Community
libraries
Built a library for a language or framework we don't list? Send it to us, and we'll consider it for this page.
Your library
Less code to write
A search is one method call, with no URL to build and no JSON to parse. For Notion integrations, use the Note API Connector (opens in a new tab).
Same methods in every language
Python, JavaScript/TypeScript, or PHP: each SDK has the same methods and typed responses.
Tested and documented
Each repository includes examples and tests you can start from.
FAQ
https://gnews.io/api/v4/search?q=AI&lang=en&apikey=YOUR_API_KEY, and read the JSON response. To build requests without writing code, use the API Playground in your dashboard. Every parameter is described in the documentation. totalArticles counts every article that matched your request. The response holds one page of them. Raise max up to the limit of your plan (up to 100 on paid plans, 10 on the Free plan) and step through the pages with page. Pagination stops at 1,000 articles, so narrow the query or the date range to go further. apikey query parameter or the X-Api-Key header. On a server, prefer the header, which keeps the API key out of URLs and server logs. A missing or malformed API key returns a 400 error. A well-formed API key that doesn't match any account returns a 401 error. See Authentication in the documentation. q takes at most 200 characters, with exact phrases, parentheses, and the AND, OR, and NOT operators. A space works as AND. OR has higher precedence than AND, so add parentheses when you mix them. URL-encode the query. On the Search endpoint, in sets the fields searched. See Query Syntax in the documentation. 400: The API key is missing or malformed, or theqparameter is missing, too long, or has a syntax error.401: The API key is well-formed but doesn't match any account.403: The account's email address isn't verified, or the daily quota is used up.404: The endpoint doesn't exist, or the request doesn't use GET.429: Too many requests per second: 10 on paid plans, 1 on the Free plan.500: An unexpected problem on our side.503: A temporary problem on our side.
Every message is listed in Error Handling, in the documentation.
429 error. Space out your requests, and retry after a short wait with exponential backoff. localhost, so browsers block requests from a deployed website. An API key in front-end code is visible to anyone, so on a public website, call the API from your backend. pip install langchain-gnews gives LangChain and LangGraph agents two tools: news search with historical data since 2020, and top headlines by category and country. It uses your API key. See the LangChain page in the documentation. Looking for something else? See all frequently asked questions.
Ready to build
with GNews API?
Get your API key and make your first request in minutes.