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

https://newsinsightapi.com/api

Authentication

All API requests require authentication using your API key in the header.

Endpoints

GET /articles/latest

Retrieve news articles from the current date.

Latest Articles /api/articles/latest

Returns articles published on the current date only.

GET /articles/search

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

q Required string

- Search query text

start_date Optional string (YYYY-MM-DD)

- Filter articles published on or after this date. If provided without end_date, returns all articles from this date onwards.

end_date Optional string (YYYY-MM-DD)

- Filter articles published before this date. Only used if start_date is also provided.

Examples

Latest Articles

GET /articles/latest
curl -H "X-API-Key: your-api-key" "https://newsinsightapi.com/api/articles/latest"
import 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/search
curl -H "X-API-Key: your-api-key" "https://newsinsightapi.com/api/articles/search?q=Trump&start_date=2024-04-03"
import 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