Skip to main content

Make your first request

Fetch current weather conditions in Celsius (units=metric) for Rio de Janeiro using the OPENWEATHER_API_KEY environment variable you configured in Get your API key.

Send a request​

Select curl, Node.js, or Python and run the request in the same terminal session where OPENWEATHER_API_KEY is set.

Send a GET request to /data/2.5/weather with URL-encoded city and units=metric query parameters:

curl "https://api.openweathermap.org/data/2.5/weather?q=Rio%20de%20Janeiro&units=metric&appid=$OPENWEATHER_API_KEY"

Inspect the response​

A 200 OK call to /data/2.5/weather returns a JSON object containing geographic coordinates, weather condition codes, atmospheric readings, wind measurements, and metadata (abbreviated below):

{
"coord": {
"lon": -43.2075,
"lat": -22.9028
},
"weather": [
{
"id": 800,
"main": "Clear",
"description": "clear sky",
"icon": "01d"
}
],
"main": {
"temp": 28.5,
"feels_like": 30.8,
"temp_min": 27.2,
"temp_max": 29.4,
"pressure": 1014,
"humidity": 70
},
"wind": {
"speed": 3.6,
"deg": 120
},
"sys": {
"country": "BR",
"sunrise": 1715244180,
"sunset": 1715284620
},
"name": "Rio de Janeiro",
"cod": 200
}

The table below summarizes the primary fields you'll work with in most applications:

FieldTypeDescription
namestringMatched city name ("Rio de Janeiro").
sys.countrystringTwo-letter ISO 3166-1 alpha-2 country code ("BR").
main.tempnumberCurrent temperature in the requested unit system (°C for metric, °F for imperial, K for standard).
main.feels_likenumberPerceived temperature accounting for humidity and wind.
main.humidityintegerRelative humidity percentage (0–100).
weather[0].descriptionstringWeather condition summary ("clear sky").
wind.speednumberWind speed in m/s for metric and standard units, or mph for imperial units.
codintegerResponse status code (200 indicates success).

Next steps​

You've authenticated with the OpenWeatherMap API, sent a parameterized request, and parsed live weather data. Choose where to go next:

  • Experiment in the browser: Test live queries, switch unit systems, and inspect raw responses in the interactive API playground.
  • Build a complete project: Follow the hands-on Tutorials to build a multi-city Node.js dashboard or a Python weather CLI tool.
  • Review full schemas: Look up every query parameter and response property in the Current weather reference.