Home
Support Forums

API Not Working In Netlify Website

Hi, I am trying to deploy a website that uses API but API is working in local computer.
API Link: https://newsapi.org/v2/top-headlines?country=in&apiKey=9375f246cb5d40f194db4cb7044dd7ce
Website Link: https://news-india.netlify.app/

Hi @AayushBiswas32

The response from the API is

{
  "status": "error",
  "code": "corsNotAllowed",
  "message": "Requests from the browser are not allowed on the
     Developer plan, except from localhost."
}

My Console is showing Failed to load resource: the server responded with a status of 426 () Failed to load resource: the server responded with a status of 404 ()

They are giving you a HTTP 426 because you are using a developer account which you can (apparently) only use from a localhost ie. you cannot use the free developer account in a live/production environment.

1 Like