Authentication
GNews API uses API keys for authentication. If you don't have an API key yet, you have to sign up first. Once you have created an account you will find your API key in your dashboard.
Get API keyYou can authenticate in two ways:
- With the
apikey
parameter in the query string- e.g.,
https://gnews.io/api/v4/{endpoint}?apikey=YOUR_API_KEY
- e.g.,
- With the
X-Api-Key
header
If the API key is not set or the API key provided is invalid, you will receive a 401 - Unauthorized
HTTP error.