> **Building with AI coding agents?** Install the authstack plugin with one command. This equips your agent with accurate Scalekit implementation patterns.
>
> **Recommended** (the `-y` flags skip prompts, so the command runs without an interactive terminal):
> ```bash
> npx -y @scalekit-inc/cli setup -y
> ```
>
> Global:
> ```bash
> npm install -g @scalekit-inc/cli
> scalekit setup -y
> ```
>
> Supports Claude Code, Cursor, GitHub Copilot, Codex + skills for other Agent Skills-compatible agents in `~/.agents/skills`.
> Skills: integrate-agentkit, implement-saaskit, add-mcp-oauth, implement-sso, implement-scim.
> [Full setup guide](https://docs.scalekit.com/dev-kit/build-with-ai/)

---

# Connect AI agents to NewsAPI

The NewsAPI connector lets your AI agent act in each user's NewsAPI account. Each user connects their own NewsAPI API key once, and Scalekit sends it with every call, so your agent never handles credentials. It comes with 3 tools.

**Authentication:** API Key
**Categories:** Media, Search
**Tools:** 3: 3 read, 0 write, 0 destructive
**Users sign in with:** API key
**Built by:** Scalekit connector
**Try it:** [Playground in the Scalekit dashboard](https://app.scalekit.com/ws/signup?sk_intent=playground&provider=NEWSAPI)

## Setup

1. ### Install the SDK

   **Node.js**

   ```bash
   npm install @scalekit-sdk/node dotenv
   ```

   **Python**

   ```bash
   pip install scalekit-sdk-python python-dotenv
   ```

2. ### Set your credentials

   Add your Scalekit credentials to your `.env` file. Find values in **[app.scalekit.com](https://app.scalekit.com)** > **Developers** > **API Credentials**.

   ```sh title=".env"
   SCALEKIT_ENVIRONMENT_URL=<your-environment-url>
   SCALEKIT_CLIENT_ID=<your-client-id>
   SCALEKIT_CLIENT_SECRET=<your-client-secret>
   ```

3. ### Create the NewsAPI connection

   In **AgentKit > Connections**, create a NewsAPI connection. The name you give it is the `connection_name` your code passes. See [Configure connections](/agentkit/connections/).

4. ### Authorize a user and make your first call

   **Node.js** (`quickstart.mts`)

   ```typescript
   import { ScalekitClient } from '@scalekit-sdk/node'
   import 'dotenv/config'
   import { createInterface } from 'node:readline/promises'

   const scalekit = new ScalekitClient(
     process.env.SCALEKIT_ENVIRONMENT_URL,
     process.env.SCALEKIT_CLIENT_ID,
     process.env.SCALEKIT_CLIENT_SECRET,
   )
   const actions = scalekit.actions

   const connector = 'newsapi'
   const identifier = 'user_123'

   // Generate an authorization link for the user
   const { link } = await actions.getAuthorizationLink({ connectionName: connector, identifier })
   console.log('Authorize NewsAPI:', link)
   const rl = createInterface({ input: process.stdin, output: process.stdout })
   await rl.question('Press Enter after authorizing...')
   rl.close()

   // Make your first call
   const result = await actions.executeTool({
     connector,
     identifier,
     toolName: 'newsapi_articles_search',
     toolInput: {},
   })
   console.log(result)
   ```

   ```bash
   npx tsx quickstart.mts
   ```

   **Python** (`quickstart.py`)

   ```python
   import os
   from scalekit import ScalekitClient
   from dotenv import load_dotenv
   load_dotenv()

   scalekit_client = ScalekitClient(
       env_url=os.getenv("SCALEKIT_ENVIRONMENT_URL"),
       client_id=os.getenv("SCALEKIT_CLIENT_ID"),
       client_secret=os.getenv("SCALEKIT_CLIENT_SECRET"),
   )
   actions = scalekit_client.actions

   connection_name = "newsapi"
   identifier = "user_123"

   # Generate an authorization link for the user
   link_response = actions.get_authorization_link(
       connection_name=connection_name,
       identifier=identifier,
   )
   print("Authorize NewsAPI:", link_response.link)
   input("Press Enter after authorizing...")

   # Make your first call
   result = actions.execute_tool(
       tool_input={},
       tool_name="newsapi_articles_search",
       connection_name=connection_name,
       identifier=identifier,
   )
   print(result)
   ```

   ```bash
   python quickstart.py
   ```

   Each user opens the link once and enters their NewsAPI credentials there. See [Authorize a user](/agentkit/tools/authorize/) for the full flow and statuses.

## Tools

Pass the exact name to `execute_tool`, with an input like each tool's example. To ask for a tool that's missing, use the [request form](https://scalekitsupport.portal.usepylon.com/forms/request-a-connector-tool).

**Node.js**

```typescript
const result = await actions.executeTool({
  toolName: 'newsapi_articles_search',
  toolInput: {},
  connector: 'newsapi',
  identifier: 'user_123',
})
```

**Python**

```python
result = actions.execute_tool(
    tool_name="newsapi_articles_search",
    tool_input={},
    connection_name="newsapi",
    identifier="user_123",
)
```

`result.data` is the app's response as JSON, and `result.execution_id` (`executionId` in Node.js) is the ID of the call.

### `newsapi_articles_search`

Search All Articles · Read-only

Search news and blog articles from over 150,000 sources by keyword, source, domain, date and language.
Returns status, totalResults and articles with source, author, title, description, url, urlToImage, publishedAt and content (truncated to 200 characters).
Use this to research a topic across all articles. Use newsapi_top_headlines_list for current breaking headlines. Set at least one of q, sources or domains.

Read only: yes. Destructive: no. Idempotent (safe to retry): yes.

Inputs:

- `domains` (`string`, optional): Comma-separated domains to restrict the search to. Example: bbc.co.uk,techcrunch.com.
- `exclude_domains` (`string`, optional): Comma-separated domains to remove from the results. Example: engadget.com.
- `from` (`string`, optional): Oldest article date and optional time, in ISO 8601. Defaults to the oldest your plan allows. Example: 2026-11-01.
- `language` (`string`, optional): Two-letter ISO-639-1 language code. Defaults to all languages. Example: en. One of: `ar`, `de`, `en`, `es`, `fr`, `he`, `it`, `nl`, `no`, `pt`, `ru`, `sv`, `ud`, `zh`.
- `page` (`integer`, optional): Page number to return, starting at 1. Defaults to 1. Example: 1.
- `page_size` (`integer`, optional): Number of articles per page. Defaults to 100, maximum 100. Example: 100.
- `q` (`string`, optional): Keywords or phrase to search for in the title and body, up to 500 characters. Use quotes for an exact phrase, + for words that must appear, - for words that must not, and AND / OR / NOT with parentheses. Example: crypto AND (ethereum OR litecoin) NOT bitcoin.
- `search_in` (`string`, optional): Fields to restrict the q search to, comma-separated: title, description, content. Defaults to all fields. Example: title,description.
- `sort_by` (`string`, optional): Sort order: relevancy (closest to q first), popularity (popular sources first) or publishedAt (newest first, the default). Example: publishedAt. One of: `relevancy`, `popularity`, `publishedAt`.
- `sources` (`string`, optional): Comma-separated source IDs (maximum 20) to search. Get IDs from newsapi_sources_list. Example: bbc-news,the-verge.
- `to` (`string`, optional): Newest article date and optional time, in ISO 8601. Defaults to the newest your plan allows. Example: 2026-11-15T23:59:59.

Example input: `{}`

### `newsapi_sources_list`

List News Sources · Read-only

List the news sources available for top headlines, optionally filtered by category, language or country.
Returns sources with id, name, description, url, category, language and country.
Use this to find source IDs for newsapi_top_headlines_list or newsapi_articles_search.

Read only: yes. Destructive: no. Idempotent (safe to retry): yes.

Inputs:

- `category` (`string`, optional): Only sources that publish this category. Defaults to all categories. Example: business. One of: `business`, `entertainment`, `general`, `health`, `science`, `sports`, `technology`.
- `country` (`string`, optional): Only sources based in this two-letter ISO 3166-1 country. Defaults to all countries. Example: gb. One of: `ae`, `ar`, `at`, `au`, `be`, `bg`, `br`, `ca`, `ch`, `cn`, `co`, `cu`, `cz`, `de`, `eg`, `fr`, `gb`, `gr`, `hk`, `hu`, `id`, `ie`, `il`, `in`, `it`, `jp`, `kr`, `lt`, `lv`, `ma`, `mx`, `my`, `ng`, `nl`, `no`, `nz`, `ph`, `pl`, `pt`, `ro`, `rs`, `ru`, `sa`, `se`, `sg`, `si`, `sk`, `th`, `tr`, `tw`, `ua`, `us`, `ve`, `za`.
- `language` (`string`, optional): Only sources in this two-letter ISO-639-1 language. Defaults to all languages. Example: en. One of: `ar`, `de`, `en`, `es`, `fr`, `he`, `it`, `nl`, `no`, `pt`, `ru`, `sv`, `ud`, `zh`.

Example input: `{}`

### `newsapi_top_headlines_list`

List Top Headlines · Read-only

List live top and breaking headlines by country, category, source or keyword.
Returns status, totalResults and articles with source, author, title, description, url, urlToImage, publishedAt and content.
Use this for current headlines. Use newsapi_articles_search to search all articles over time. Do not combine sources with country or category.

Read only: yes. Destructive: no. Idempotent (safe to retry): yes.

Inputs:

- `category` (`string`, optional): Headline category. Cannot be combined with sources. Example: technology. One of: `business`, `entertainment`, `general`, `health`, `science`, `sports`, `technology`.
- `country` (`string`, optional): Two-letter ISO 3166-1 country code to get headlines for. Cannot be combined with sources. Example: us.
- `page` (`integer`, optional): Page number to return, starting at 1. Defaults to 1. Example: 1.
- `page_size` (`integer`, optional): Number of articles per page. Defaults to 20, maximum 100. Example: 20.
- `q` (`string`, optional): Keywords or a phrase to search for in the headlines. Example: election.
- `sources` (`string`, optional): Comma-separated source IDs to get headlines from. Get IDs from newsapi_sources_list. Cannot be combined with country or category. Example: bbc-news.

Example input: `{}`

## Related

Other Media connectors ([all 65](/agentkit/connectors/?category=media)):

- [Spotify](/agentkit/connectors/spotify/): Scalekit connector, OAuth, 47 tools
- [Reddit](/agentkit/connectors/reddit/): Scalekit connector, OAuth, 105 tools
- [Diarize](/agentkit/connectors/diarize/): Scalekit connector, Access token, 3 tools


---

## More Scalekit documentation

| Resource | What it contains | When to use it |
|----------|-----------------|----------------|
| [/llms.txt](/llms.txt) | Structured index with routing hints per product area | Start here — find which documentation set covers your topic before loading full content |
| [/llms-full.txt](/llms-full.txt) | Complete documentation for all Scalekit products in one file | Use when you need exhaustive context across multiple products or when the topic spans several areas |
| [sitemap-0.xml](https://docs.scalekit.com/sitemap-0.xml) | Full URL list of every documentation page | Use to discover specific page URLs you can fetch for targeted, page-level answers |
