View as Markdown
News API icon

News API ACTION

Search Top Headlines

Retrieve live top and breaking headlines for a category, single source, multiple sources, or keywords. See the documentation
  • Action
  • Read only
  • API key
  • SDK
  • MCP

IMPLEMENTATION

Call this tool

Connect a user's News API account once, then configure and run Search Top Headlines from your backend or agent.

import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "news_api-search-top-headlines",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    news_api: { authProvisionId: "apn_xxxxxxx" },
    q: "Query",
    category: "Category",
  },
})

console.log(result)

SCHEMA

Inputs

Pipedream supplies the connected account. Your application provides the operation-specific values below. Dynamic inputs are resolved against that user's account.

Search Top Headlines inputs
Property Type Description
q Query string
Keywords or phrases to search for
Optional
category Category string
The category you want to get headlines for. Possible options: business entertainment general health science sports technology. Note: you can't mix this param with the sources param.
Optional
sourceIds Source IDs string[]
An array of source identifiers (maximum 20) for the news sources or blogs you want headlines from
Optional Dynamic
maxResults Max Results integer
The maximum number of results to return. Must be between 1 and 100.
Optional

REFERENCE

Tool details

Behavior hints are published with the component in the Pipedream registry and surface as MCP tool annotations, so an agent can reason about a tool before it calls it.

Registry key
news_api-search-top-headlines
Version
0.0.3
App
News API
Authentication
API key
Read-only
Yes
Destructive
No
Open world
Yes