Skip to main content
All requests to the Current Weather Data API require an API key.

Get an API key

If you don’t have an API key yet:
  1. Sign in to your account.
  2. In the top menu, click your name > My API keys.
Make sure your API key is Active.

Use your API key

Include your API key in every request using the appid parameter. Example:
curl "https://api.openweathermap.org/data/2.5/weather?lat=48.85&lon=2.35&units=metric&appid=YOUR_API_KEY"
Replace YOUR_API_KEY with your actual API key.

Security best practices

  • Do not hardcode your API key in client-side code
  • Store it in an environment variable
  • Never commit your API key to version control
Example using an environment variable:
export OPENWEATHER_API_KEY=your_api_key_here

curl "https://api.openweathermap.org/data/2.5/weather?lat=48.85&lon=2.35&units=metric&appid=$OPENWEATHER_API_KEY"

Common issues

ErrorCauseSolution
401 UnauthorizedMissing, invalid, or inactive API keyCheck your appid value, activation status, and request format