Annual Plans Get 2 Months Free

API Documentation

Base URL

https://api.newsmesh.co/v1

Authentication

All API endpoints require an API key passed as a query parameter:

?apiKey=your_api_key_here

Endpoints


Get Latest Articles

GET/v1/latest

Get latest articles (automatically applies history window based on your plan).

Query Parameters

  • apiKey (required)
  • limit (optional, default: 10, max: 10 on Free & Starter, max: 25 on Growth & Pro)
  • category (optional) — Comma-separated, max 10
  • country (optional) — Filter by content relevance (what countries the article discusses)
  • sourceCountry (optional) — Filter by news outlet's country (where the source is based)
  • cursor (optional) — Pagination cursor from previous response

Available Countries

Both country and sourceCountry accept ISO 3166-1 alpha-2 codes (35 countries supported):

View all country codes
au Australiaie Irelandsg Singaporebe Belgiumil Israelza South Africabr Brazilit Italykr South Koreaca Canadajp Japantw Taiwancn Chinamy Malaysiath Thailandco Colombiamx Mexicotr Turkeyeg Egyptnl Netherlandsae UAEfr Franceng Nigeriaua Ukrainede Germanyno Norwaygb United Kingdomhk Hong Kongph Philippinesus United Statesin Indiaru Russiave Venezuelaid Indonesiasa Saudi Arabia

Available Categories

politics, technology, business, health, entertainment, sports, science, lifestyle, environment, world

Examples

# Get latest 10 articles
$ curl "https://api.newsmesh.co/v1/latest?apiKey=nm_xxx&limit=10"

# Get sports articles
$ curl "https://api.newsmesh.co/v1/latest?apiKey=nm_xxx&category=sports"

# Filter by multiple categories
$ curl "https://api.newsmesh.co/v1/latest?apiKey=nm_xxx&category=politics,business"

# Get news about events in the US
$ curl "https://api.newsmesh.co/v1/latest?apiKey=nm_xxx&country=us"

# Get news about multiple countries
$ curl "https://api.newsmesh.co/v1/latest?apiKey=nm_xxx&country=us,gb,ca"

# Combine country and category filters
$ curl "https://api.newsmesh.co/v1/latest?apiKey=nm_xxx&country=us&category=politics"


Get Single Article

GET/v1/article/{article_id}

Get a specific article by its ID.

Path Parameters

  • article_id (required) — Unique article identifier

Example

$ curl "https://api.newsmesh.co/v1/article/4c213ea447c9773981780776c9b7399b?apiKey=nm_xxx"

Error Responses

All endpoints return errors in a consistent format:

{
  "status": "error",
  "code": "errorCodeInCamelCase",
  "message": "Human-readable error description."
}

Common Error Codes

HTTP StatusError CodeDescription
400queryMissingSearch query parameter 'q' is required
401apiKeyMissingNo API key provided
401invalidApiKeyInvalid or non-existent API key
403forbiddenAccess forbidden
429rateLimitExceededRequests per second limit exceeded
429dailyLimitExceededDaily request limit reached
429monthlyLimitExceededMonthly request limit reached

Rate Limits & Plans

PlanPriceRPSResults per RequestMonthly RequestsHistoryFreshness
Free$0/mo1107507 days24-hour delay
Starter$29/mo2105,0007 days1-hour delay
Growth$79/mo102575,00030 daysReal-time
Pro$199/mo2025250,0006 monthsReal-time

CORS Policy

The Free plan only allows requests from localhost origins (for local development). Paid plans allow requests from any origin, enabling production deployments.

Response Headers

Every response includes headers to help you pace requests and monitor usage:

X-RateLimit-Limit: 5
X-RateLimit-Remaining: 4
X-RateLimit-Reset: 1
X-Account-RateLimit-Limit: 10000
X-Account-RateLimit-Remaining: 9847
X-Account-RateLimit-Reset: 1735689600

Per-Second Rate Limit

  • X-RateLimit-Limit — Requests allowed per second
  • X-RateLimit-Remaining — Requests remaining this second
  • X-RateLimit-Reset — Seconds until reset (always 1)

Account Rate Limit (Daily Quota)

  • X-Account-RateLimit-Limit — Your daily request limit
  • X-Account-RateLimit-Remaining — Requests remaining today
  • X-Account-RateLimit-Reset — When your daily limit resets (Unix timestamp, midnight UTC)

Rate Limit Exceeded (429)

When you exceed a rate limit, the response includes:

  • Retry-After — Seconds to wait before retrying

Pagination

Endpoints that return multiple articles support cursor-based pagination:

  1. Make initial request without cursor parameter
  2. Check next_cursor in response
  3. Use next_cursor value in subsequent request
  4. Continue until next_cursor is null

Example

# Page 1
$ curl "https://api.newsmesh.co/v1/latest?apiKey=nm_xxx&limit=25"

# Page 2 (using cursor from previous response)
$ curl "https://api.newsmesh.co/v1/latest?apiKey=nm_xxx&limit=25&cursor=eyJwdWJsaXNoZWRfZGF0ZSI6..."

Best Practices

  1. Use /v1/trending for homepage feeds — it's cached and returns fastest
  2. Use /v1/latest for category browsing — no date range needed
  3. Use /v1/search for keyword search — when users need to find specific topics
  4. Cache responses — reduce API calls by caching on your end
  5. Handle rate limits gracefully — implement exponential backoff on 429 errors
  6. Store pagination cursors — for implementing infinite scroll
  7. Monitor your usage — track daily/monthly limits to avoid overage charges

Libraries

Use our official client libraries to integrate NewsMesh into your application.

🐍

Python

View Docs →

Support

For API support, contact us at:

[email protected]