News API Documentation
Welcome to the News API! This guide provides an overview of the available endpoints, parameters, and response formats for interacting with the API. Please note that all requests to the API require a token to be included as a query parameter.
News Starter App
If you wish to get started fast, checkout our News Starter App in React Native
News Starter AppBase URL
https://roxyapi.com/api/v1/data/news?token={your_api_token}
Endpoints
1. Get All News
This endpoint retrieves a paginated list of all news data entries stored in the database. You can provide optional parameters for pagination and filtering by category and tag. The token must be included as part of the query string.
https://roxyapi.com/api/v1/data/news?token={your_api_token}
# | Key | Value | Description |
---|---|---|---|
page | 1 | Page number to retrieve. Must be greater than or equal to 1. Defaults to 1. (Optional) | |
limit | 10 | Number of items per page. Must be between 1 and 10. Defaults to 10. (Optional) | |
category | world | Category to filter news by (Optional) | |
tag | sports | Tag to filter news by (Optional) |
Response Example
[
{
"tags": ["national", "world"],
"title": "US reveals identity of man linked to plot to...",
"content": "The US has for the first time revealed the identity of an...",
"country": "US",
"language": "en",
"image_url": "https://cdn.roxyapi.com/img/...",
"categories": ["world", "national"],
"created_at": "2024-10-18T03:26:16+00:00",
"source_url": "https://bbc.com/us/..."
},
// More news entries...
]
Pagination
Pagination in the News API is handled using the page and limit parameters. The page parameter defines which set of results to return, while limit determines how many results are included on each page.
https://roxyapi.com/api/v1/data/news?token={your_api_token}
# | Key | Value | Description |
---|---|---|---|
limit | 5 | Number of items per page (Optional) | |
page | 2 | Page number to retrieve (Optional) |
This would return the second page of results, with 5 news entries per page.
Additional Endpoints
Get All Unique Categories
This endpoint retrieves all unique categories present in the news data entries. This can help to filter and explore news data by specific categories.
https://roxyapi.com/api/v1/data/news/categories?token={your_api_token}
Response Example
[
"world",
"technology",
"sports",
"entertainment"
]
Get All Unique Tags
This endpoint retrieves all unique tags present in the news data entries. Use this to filter or categorize news entries by tags.
https://roxyapi.com/api/v1/data/news/tags?token={your_api_token}
Response Example
[
"breaking-news",
"economy",
"health",
"politics",
"science"
]