Authentication
Learn how to authenticate your API requests using your API key
AllNewsAPI uses API keys to authenticate requests. Your API key identifies your account and determines your access level and rate limits.
How Authentication Works
Include your API key as a query parameter in every request. The parameter name is apikey
Security Best Practices
Warning
- Never expose your API key in client-side code
- Use environment variables to store your API key
- Regenerate your API key if you suspect it has been compromised
- Use API key restrictions to limit usage to specific IPs or domains
Troubleshooting Authentication Errors
401 Unauthorized
This error occurs when your API key is invalid or missing. Double-check that you're including the 'apikey' parameter with a valid key.
403 Forbidden
This error occurs when your account doesn't have permission for the requested resource, or your API key restrictions don't allow the request.