News API endpoint suddenly returns 403

React with Vite. Plain JavaScript. Same code have worked for days. This morning it returned a 403 with the message “Subscription does not permit querying news”.

What changed? Cant find any updates in the API changelog.

Sandbox returns the same error.

Im on the free account while developing.

From .env file:
VITE_API_NEWS_URL = “https://data.alpaca.markets/v1beta1/news

import { useState, useEffect } from "react";
import NewsItem from "./NewsItem";

const options = {
  method: "GET",
  headers: {
    accept: "application/json",
    "APCA-API-KEY-ID": import.meta.env.VITE_API_KEY_ALPACA,
    "APCA-API-SECRET-KEY": import.meta.env.VITE_API_SECRET_ALPACA,
  },
};

const NewsFeed = () => {
  const [newsItems, setNewsItems] = useState("");
  const [fetchStatus, setFetchStatus] = useState("");

  useEffect(() => {
    fetch(
      `${import.meta.env.VITE_API_NEWS_URL}?sort=desc&limit=50&include_content=true&exclude_contentless=false`,
      options,
    )
      .then((response) => response.json())
      .then((response) => setNewsItems(response.news))
      .catch((err) => {
        setFetchStatus(err);
      });
  }, []);

  if (newsItems) {
    return (
      <>
        <article className="newsFeed">
          {newsItems.map((item) => {
            return (
              <NewsItem key={item.id} arrived_at={item.arrived_at} {...item} />
            );
          })}
        </article>
      </>
    );
  } else return <div>Could not fetch news from API {fetchStatus}</div>;
};

export default NewsFeed;
2 Likes

Same for me - Worked fine yesterday

Having the same issue. Not working for me either at:

Same situation for me. Worked one day with the
base_url = 'https://paper-api.alpaca.markets'
then next day stopped working.
Then I got it to work with
base_url = 'https://api.alpaca.markets'

But now neither are working. I just get the error
APIError: Subscription does not permit querying news

Is this a bug? Can we get a fix on this please, so that the API is reliable?

Same here. My Python code has been working for months. Today suddenly got a 403. I hope they didn’t take away the free news feature :unamused:

        # prepare the request URL
        headers = {
            "Apca-Api-Key-Id": self._api_key,
            "Apca-Api-Secret-Key": self._api_secret,
        }

        # As per parameters here: https://alpaca.markets/docs/api-references/market-data-api/news-data/historical/
        params = {
            "start": self._from_datetime.strftime("%Y-%m-%dT%H:%M:%SZ"),
            "end": self._to_datetime.strftime("%Y-%m-%dT%H:%M:%SZ"),
            "limit": 50,
            "include_content": True,
            "sort": "ASC",
        }

        response = requests.get(self.NEWS_URL, headers=headers, params=params)

Just noticed that the websocket news is working. So the REST API should still be avalible.

Same problem for me. Is Alpaca working on fixing this problem?

curl -H 'Apca-Api-Key-Id: <key_id>' -H 'Apca-Api-Secret-Key: <secret_key>' "https://data.alpaca.markets/v1beta1/news?symbols=AAPL"
{"message":"Subscription does not permit querying news"}

@stochastic_developer The news API is back up and running now. Apologies for the downtime.

3 Likes

Working for me again. Thanks.

Are the news via websocket also affected? I implemented it today but I’m getting nothing.

@Jz80 The websocket streaming wasn’t impacted and should be up and running. Perhaps there wasn’t any news because it was before market hours? Are you still not seeing anything?

I haven’t received any news in the last hour. My news code is brand new, but I’m using the same code that I’ve been using for the stocks, so the websocket code should be ok.
Login and authorization seems to work.
I don’t have to subscribe for the news as I do for the stocks, isn’t it?

@Jz80 Are you still having issues getting news?

Sorry for the delay. I’ve tested the app sporadically during market time but I haven’t received anything yet.