Getting subscription error message despite having valid RapidAPI key configured

I keep getting a subscription error when trying to use a RapidAPI endpoint even though I have the API key set up correctly. The error message says I’m not subscribed to the API but I should have access.

Here’s my API configuration:

import fetch from 'node-fetch';

const API_ENDPOINT = 'https://video-search-v2.p.rapidapi.com';

const requestOptions = {
  method: 'GET',
  headers: {
    'X-RapidAPI-Key': process.env.REACT_APP_API_SECRET,
    'X-RapidAPI-Host': 'video-search-v2.p.rapidapi.com'
  }
};

export const getData = async(endpoint) => {
  const response = await fetch(`${API_ENDPOINT}/${endpoint}`, requestOptions);
  const result = await response.json();
  return result;
};

And here’s how I’m calling it:

import { getData } from '../helpers/getData';

const VideoList = () => {
  const [currentFilter, setCurrentFilter] = useState('trending');
  const [videoData, setVideoData] = useState([]);

  useEffect(() => {
    getData(`query?type=video&search=${currentFilter}&limit=25`)
      .then((response) => setVideoData(response.results))
      .catch(err => {
        console.error('API Error:', err);
      });
  }, [currentFilter]);
};

I have my API key stored in the .env file in the project root. What could be causing this subscription error to appear?

Had the same issue - API key was fine but kept getting subscription errors. RapidAPI has different tiers and some endpoints need higher access even within the same API. Check the pricing section to see exactly which endpoints your subscription covers. Also, some APIs throw subscription-like errors when you hit rate limits. Try a simple test call with a basic endpoint first to see if it’s actually a subscription problem or just your query parameters.

Had this exact issue last month. The problem was my environment variable name. You’re using REACT_APP_API_SECRET but that prefix is only for Create React App frontend variables. If you’re running this in Node.js backend, just use API_SECRET or something similar - drop the REACT_APP_ part. Also make sure your .env file is actually loading in your Node environment. I had to restart my dev server after changing the variable name to get it working.

check ur rapidapi dashboard - ensure u are subbed to that api. subscription might’ve expired or u might be on the wrong tier. also, try logging process.env.REACT_APP_API_SECRET to see if the key is loading right.