# API Documentation: News Search API

[ChatGPT ↗](https://chatgpt.com/?q=Read%20https%3A%2F%2Fnewssearchapi.com%2Fdocs%2F%20and%20help%20me%20build%20with%20the%20News%20Search%20API.)[Claude ↗](https://claude.ai/new?q=Read%20https%3A%2F%2Fnewssearchapi.com%2Fdocs%2F%20and%20help%20me%20build%20with%20the%20News%20Search%20API.)

DOCUMENTATION

# Build with News Search API

One REST API for searching and reading news from publishers worldwide. JSON over HTTPS, a predictable envelope, and plain-English errors.

## Try it now. No key needed.

`GET /v1/headlines/sample` is public, so you can see real output before you sign up. Paste this into a terminal:

```
curl "https://apis.newssearchapi.com/v1/headlines/sample"
```

```
const response = await fetch("https://apis.newssearchapi.com/v1/headlines/sample");
const data = await response.json();
```

```
import os
import requests

response = requests.get(
    "https://apis.newssearchapi.com/v1/headlines/sample",
)
data = response.json()
```

```
req, _ := http.NewRequest(
    "GET",
    "https://apis.newssearchapi.com/v1/headlines/sample",
    nil,
)
resp, err := http.DefaultClient.Do(req)
```

```
$response = file_get_contents(
    "https://apis.newssearchapi.com/v1/headlines/sample"
);
$data = json_decode($response, true);
```

Ready for the full API? [Create a free key](/signin). No card required; see [Plans](/pricing) for the credits it includes.

## The basics

Base URL

`https://apis.newssearchapi.com`

Authentication

`X-Api-Key: <your key>` header. [More options](/docs/authentication)

Format

JSON. Success responses have `"status": "ok"`.

Errors

Stable `code`, readable `message` and a `requestId`. [All codes](/docs/errors)

Versioning

The version is in the path (`/v1`). Breaking changes are announced in the [changelog](/docs/changelog) first.

CORS

Enabled for `GET`, but keep keys on your server, not in browser code.

## Start here

-   [**Quickstart**Get a key and make your first authenticated request in about five minutes.](/docs/quickstart)
-   [**API reference**Every endpoint, parameter and response field, with live requests.](/docs/reference)
-   [**Authentication**Header, bearer or query-string keys, and how to keep them safe.](/docs/authentication)
-   [**MCP server**Give Claude, Cursor or VS Code agents live news in one config block.](/docs/mcp)

## Endpoints

-   [`GET` `/v1/articles` Search articles](/docs/reference/searchArticles)
-   [`GET` `/v1/articles/{id}` Get one article](/docs/reference/getArticle)
-   [`GET` `/v1/counts` Count articles over time](/docs/reference/countArticles)
-   [`GET` `/v1/stats` Coverage statisticsPublic · No API key](/docs/reference/getStats)
-   [`GET` `/v1/headlines/sample` Sample of latest headlinesPublic · No API key](/docs/reference/sampleHeadlines)
-   [`GET` `/v1/publisher-icons/{domain}` Get a publisher iconPublic · No API key](/docs/reference/getPublisherIcon)
-   [`GET` `/health` Health checkPublic · No API key](/docs/reference/health)

## Build with AI

-   [**TypeScript & Python SDKs**Typed clients with pagination and polling helpers.](/docs/sdks)
-   [**Keep a RAG index fresh**Poll only newly indexed articles with a durable cursor.](/docs/guides/rag)
-   [**LLM tool calling**Ready-made OpenAI and Anthropic tool schemas for news search.](/docs/guides/tool-calling)
-   [**OpenAPI 3.1 spec**Import into Postman, Insomnia or a client generator.](/openapi.yaml)

## Getting help

Include the `requestId` from the error body (or the `X-Request-Id` header) when you [email developer support](mailto:support@newssearchapi.com?subject=API%20support), so we can find the exact request. Check [API status](/status) if requests start failing unexpectedly.
