Getting Started
Learn how to make your first API request and start fetching news data
Welcome to AllNewsAPI! This guide will walk you through the basics of using our API to fetch news articles from around the world.
1. Get Your API Key
First, you'll need an API key to authenticate your requests. Sign up for a free account to get your API key instantly.
2. Make Your First Request
Once you have your API key, you can make your first API request. Here's a simple example to search for news articles:
3. Understand the Response
The API returns a JSON response containing an array of news articles. Each article includes the following properties:
Name | Type | Default Value | Description |
|---|---|---|---|
totalArticles | integer | — | The total number of articles matching your search query |
currentPage | integer | — | The current page number in the paginated results |
nextPage | integer | — | The next page number (null if on last page) |
articles | array | — | An array of article objects matching your search criteria |
articles[].title | string | — | The title of the news article |
articles[].description | string | — | The description or summary of the news article |
articles[].category | string | — | The category that the article falls under |
articles[].content | string | — | The full content of the news article (premium feature) |
articles[].country | string | — | The country code where the article was published (ISO 3166-1 alpha-2) |
articles[].region | string | — | The geographic region where the article was published |
articles[].lang | string | — | The language code of the article (ISO 639-1) |
articles[].sentiment | string | — | The overall sentiment of the article (positive, negative, neutral) analyzed using AI |
articles[].sentimentScores | object | — | Detailed sentiment scores with numerical values for negative, neutral, and positive sentiments |
articles[].url | string | — | The direct URL to the original article |
articles[].image | string | — | The main image or thumbnail URL of the article |
articles[].publishedAt | string | — | The publication date and time of the article in ISO 8601 format (UTC) |
articles[].source.name | string | — | The name of the news publisher or source |
articles[].source.url | string | — | The homepage URL of the news source |
The free tier includes access to real-time news data, up to 50 requests per day, and 7 days of historical data. No credit card required!
Next Steps
Now that you've made your first request, explore these guides to learn more: