How to get a NewsAPI API key

NewsAPI issues a key the moment you register. It is used in the X-Api-Key header.

About 3 minutes 3 steps Checked October 2026

Before you start

  • An email address

Create your NewsAPI API key

  1. 1

    Register

    Go to newsapi.org/register, enter your name, email and a password, and accept the terms.

  2. 2

    Copy your key

    Your API key is shown right after registration and on your Account page. Save it as NEWS_API_KEY.

  3. 3

    Set a news query

    In AlgoGP set news_query in config.json (e.g. bitcoin OR btc) and enable filters.sentiment with the news source. Backtests use the keyless archive; the key adds NewsAPI headlines when live.py runs.

Test the key

Before wiring the key into a strategy, make one request by hand. It separates “the key is wrong” from “my code is wrong”.

curl -s -H "X-Api-Key: $NEWS_API_KEY" \
  "https://newsapi.org/v2/everything?q=bitcoin&pageSize=3&sortBy=publishedAt"
"status":"ok" with articles means the key works; apiKeyInvalid means it does not.

Add the key to your AlgoGP project

  1. 1

    Open your project’s APIs & keys tab

    Open the strategy project and select APIs & keys in the workspace tabs.

  2. 2

    Paste each value

    Paste the values into NEWS_API_KEY and click Save. Values are encrypted at rest, never shown again and never written into code or exports.

  3. 3

    Run locally with the same names

    Exported projects read the same names from .env (copy .env.example). Keep .env out of version control.

NEWS_API_KEY=paste-your-value-here
.env for local runs

Troubleshooting

rateLimited
More than 100 requests today on the free plan.
parameterInvalid (date)
A from date older than your plan allows.
corsNotAllowed
Browser requests are only allowed from localhost on the free plan; call it from server code.

Frequently asked questions

Is a NewsAPI key free?

Yes, the Developer plan key is free for development with 100 requests per day.

Add NewsAPI signals to a strategy

Combine price rules with news and sentiment filters, test them point-in-time so nothing leaks from the future, and export the code.

  • Sentiment filters that block entries on bad news
  • Point-in-time replay in every backtest
  • Exported Python reads the same feed live

Free plan, no card required.

How the NewsAPI API works

AlgoGP is not affiliated with NewsAPI. Menus get renamed from time to time; if a label differs, the official documentation has the current path.