NewsAPI

Search worldwide news with code

Go to site
Explore
/
Apps
/
NewsAPI

NewsAPI API Integrations

Build and run workflows using the NewsAPI API. Use 1000s of source-available triggers and actions across 1000+ apps. Or write custom code to integrate any app or API in seconds.

Overview

With the NewsAPI API, you can build apps that:

  • Retrieve news stories from over 70 different sources
  • Filter stories by keyword, topic, or location
  • Display story headlines, descriptions, and images
  • Stay up-to-date with the latest news stories as they happen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { axios } from "@pipedream/platform"
export default defineComponent({
  props: {
    newsapi: {
      type: "app",
      app: "newsapi",
    }
  },
  async run({steps, $}) {
    return await axios($, {
      url: `https://newsapi.org/v2/top-headlines`,
      headers: {
        Authorization: `Bearer ${this.newsapi.$auth.oauth_access_token}`,
      },
      params: {
        country: `us`,
        category: `business`,
        apiKey: `${this.newsapi.$auth.api_key}`,
      },
    })
  },
})

Authentication

NewsAPI uses API keys for authentication. When you connect your NewsAPI account, Pipedream securely stores the keys so you can easily authenticate to NewsAPI APIs in both code and no-code steps.

Get your API key in your account settings.