# Quickstart: Your First News API Call

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

QUICKSTART · ABOUT 5 MINUTES

# Your first API call

Get a free key, search the news for "climate" and print the headlines. You need a terminal, nothing else.

1.  ## Get a free API key
    
    [Sign in](/signin), open **API keys** in the console and create a key. Copy it right away: the full key is only shown once. Keys start with `gna_live_`.
    
    The Free plan needs no card. See [Plans](/pricing) for the credits and capabilities each plan includes.
    
2.  ## Store it in an environment variable
    
    Keep the key out of your code so it never ends up in Git.
    
    ```
    export NEWSSEARCHAPI_API_KEY="gna_live_your_key_here"
    ```
    
    ```
    $env:NEWSSEARCHAPI_API_KEY = "gna_live_your_key_here"
    ```
    
3.  ## Make a request
    
    Search English-language articles that mention "climate", newest first:
    
    ```
    curl "https://apis.newssearchapi.com/v1/articles?q=climate&language=en&page_size=5" \
      -H "X-Api-Key: $NEWSSEARCHAPI_API_KEY"
    ```
    
    ```
    // Node.js 18+ (built-in fetch)
    const response = await fetch("https://apis.newssearchapi.com/v1/articles?q=climate&language=en&page_size=5", {
      headers: { "X-Api-Key": process.env.NEWSSEARCHAPI_API_KEY },
    });
    const body = await response.json();
    
    if (body.status !== "ok") throw new Error(`${body.code}: ${body.message}`);
    for (const article of body.articles) console.log(article.title);
    ```
    
    ```
    import os
    import requests
    
    response = requests.get(
        "https://apis.newssearchapi.com/v1/articles?q=climate&language=en&page_size=5",
        headers={"X-Api-Key": os.environ["NEWSSEARCHAPI_API_KEY"]},
        timeout=10,
    )
    body = response.json()
    
    if body["status"] != "ok":
        raise RuntimeError(f"{body['code']}: {body['message']}")
    for article in body["articles"]:
        print(article["title"])
    ```
    
    For a quick browser test, add `&apiKey=YOUR_API_KEY` to the URL. Both methods are supported; use the `X-Api-Key` header on servers to keep keys out of URLs and logs.
    
    `q` matches every word (case-insensitive) in the title or description. Add filters such as `country`, `category`, `source` or `from`; the [article search reference](/docs/reference/searchArticles) lists them all and lets you run them live.
    
4.  ## Read the response
    
    Successful responses have `"status": "ok"`, the results in `articles`, and `totalResults`, `page` and `pageSize` for paging:
    
    200 OK
    
    ```
    {
      "status": "ok",
      "totalResults": 1342,
      "page": 1,
      "pageSize": 10,
      "articles": [
        {
          "id": "-4210765838120375291",
          "title": "Central bank holds rates steady amid cooling inflation",
          "description": "Policymakers voted 7–2 to keep the benchmark rate unchanged.",
          "content": "Policymakers voted 7–2 on Thursday to keep the benchmark rate unchanged, citing a steady decline in core inflation over the past quarter. The decision was widely expected by markets. …",
          "contentTruncated": true,
          "url": "https://www.dailyledger.example/business/rates-hold",
          "imageUrl": "https://cdn.dailyledger.example/img/rates.jpg",
          "author": "Jane Smith",
          "publishedAt": "2026-10-31T09:15:00Z",
          "language": "en",
          "country": "gb",
          "region": "Europe",
          "categories": [
            "business",
            "economy"
          ],
          "source": {
            "name": "The Daily Ledger",
            "domain": "dailyledger.example"
          },
          "indexedAt": "2026-10-31T09:15:02Z",
          "storyId": "story-2026-10-31-001",
          "trustScore": 0.94,
          "corroboratedBy": 8
        }
      ]
    }
    ```
    
    **Something went wrong?**
    
    `401 apiKeyMissing` or `apiKeyInvalid` means neither the header nor query key arrived or the key was mistyped; check the variable is set in the same terminal. `429` means you hit a rate limit or your daily quota. See [error codes](/docs/errors).
    

## Next steps

-   [**Explore every filter**Try queries live from the reference page.](/docs/reference/searchArticles)
-   [**Page through results**Fetch more than one page safely.](/docs/pagination)
-   [**Use an SDK**Typed TypeScript and Python clients.](/docs/sdks)
-   [**Connect an AI agent**Live news in Claude, Cursor or VS Code via MCP.](/docs/mcp)
