Introduction
The News Insights API provides access to news articles from various trusted sources worldwide. Our API enables you to fetch articles, search through content, and filter by source, date, and other parameters.
Base URL
Authentication
All API requests require authentication using your API key in the header.
Endpoints
Retrieve news articles from the current date.
Latest Articles /api/articles/latest
Returns articles published on the current date only.
Search articles by keyword. Parameters should be passed as URL query parameters.
Search Articles /api/articles/search
Search for articles with text matching in title, description, or content.
Parameters
- Search query text
- Filter articles published on or after this date. If provided without end_date, returns all articles from this date onwards.
- Filter articles published before this date. Only used if start_date is also provided.
Examples
Latest Articles
GET /articles/latestimport requests
headers = {
'X-API-Key': 'your-api-key'
}
response = requests.get('https://newsinsightapi.com/api/articles/latest',
headers=headers)
articles = response.json()
Search Articles
GET /articles/searchimport requests
headers = {
'X-API-Key': 'your-api-key'
}
params = {
'q': 'Trump',
'start_date': '2024-04-03'
}
response = requests.get(
'https://newsinsightapi.com/api/articles/search',
headers=headers,
params=params
)
articles = response.json()
Status Codes
The API uses standard HTTP response codes to indicate the success or failure of requests.
Status Code | Meaning |
---|---|
200 OK |
Request was successful |
400 Bad Request |
Invalid parameters |
401 Unauthorized |
Missing or invalid API key |
403 Forbidden |
API key does not have access |
429 Too Many Requests |
Rate limit exceeded |
500 Internal Server Error |
Server-side error |