Request Parameters

Every WeatherAPI.com request parameter explained: q (city, lat/lon, postcode, IP), days, dt, hour, aqi, alerts, tp, pollen and more, with examples.

Parameter Description
key Required API Key
q Required

Query parameter based on which data is sent back. It could be following:

  • Latitude and Longitude (Decimal degree) e.g: q=48.8567,2.3508
  • city name e.g.: q=Paris
  • US zip e.g.: q=10001
  • UK postcode e.g: q=SW1
  • Canada postal code e.g: q=G2J
  • metar:<metar code> e.g: q=metar:EGLL
  • iata:<3 digit airport code> e.g: q=iata:DXB
  • auto:ip IP lookup e.g: q=auto:ip
  • IP address (IPv4 and IPv6 supported) e.g: q=100.0.0.1
  • By ID returned from Search API. e.g: q=id:2801268
  • bulk New
days Required only with forecast API method.

Number of days of forecast required.

days parameter value ranges between 1 and 14. e.g: days=5

If no days parameter is provided then only today's weather is returned.

dt (Required for History and Future API) Restrict date output for Forecast and History API method.

For history API 'dt' should be on or after 1st Jan, 2010 in yyyy-MM-dd format (i.e. dt=2010-01-01)

For forecast API 'dt' should be between today and next 14 day in yyyy-MM-dd format (i.e. dt=2010-01-01)

For future API 'dt' should be between 14 days and 300 days from today in the future in yyyy-MM-dd format (i.e. dt=2023-01-01)

(Optional) unixdt Unix Timestamp used by Forecast and History API method.

unixdt has same restriction as 'dt' parameter. Please either pass 'dt' or 'unixdt' and not both in same request. e.g.: unixdt=1490227200

(Optional) end_dt (Available for History API) Restrict date output for History API method.

For history API 'end_dt' should be on or after 1st Jan, 2010 in yyyy-MM-dd format (i.e. dt=2010-01-01)

'end_dt' should be greater than 'dt' parameter and difference should not be more than 30 days between the two dates.

Only works for API on Pro plan and above.

(Optional) unixend_dt Unix Timestamp used by History API method.

unixend_dt has same restriction as 'end_dt' parameter. Please either pass 'end_dt' or 'unixend_dt' and not both in same request. e.g.: unixend_dt=1490227200

(Optional) hour Restricting forecast or history output to a specific hour in a given day.

Must be in 24 hour. For example 5 pm should be hour=17, 6 am as hour=6

(Optional) alerts Disable alerts in forecast API output

alerts=yes or alerts=no

(Optional) aqi Enable/Disable Air Quality data in forecast API output

aqi=yes or aqi=no

(Optional) pollen New Enable/Disable Pollen data in realtime, forecast, future and history API output

pollen=yes or pollen=no

(Optional) tides New Enable/Disable Tide data in Marine API output

tides=yes or tides=no

(Optional) tp New Get 15 min interval data for Forecast and History API. Available for Enterprise clients only.

tp=15

(Optional) current_fields New Pass field names as comma seperated which should be returned in the current element.

current_fields=temp_c,wind_mph

(Optional) day_fields New Pass field names as comma seperated which should be returned in the Forecast or History API day element.

day_fields=temp_c,wind_mph

(Optional) hour_fields New Pass field names as comma seperated which should be returned in the Forecast or History API hour element.

hour_fields=temp_c,wind_mph

(Optional) solar (Enterprise) New Enable solar irradiance data in History API. Available for Enterprise clients only.

solar=yes

(Optional) et0 New Enable Evapotranspiration data in Forecast and History API. Available for Business and Enterprise clients only.

et0=yes

(Optional) wind100mph (Enterprise) New Enable wind data and return wind speed in mph at 100mt height in History API. Available for Enterprise clients only.

wind100mph=yes

(Optional) wind100kph (Enterprise) New Enable wind data and return wind speed in kmph at 100mt height in History API. Available for Enterprise clients only.

wind100kph=yes

(Optional) lang Returns 'condition:text' field in API in the desired language

Pass a supported language code, e.g. lang=fr. See the full list of language codes.

Quick and Easy Signup for Weather API

WeatherAPI.com makes it super easy to integrate our realtime, daily, hourly and 15 min interval weather forecast data, historical weather, marine weather, bulk request, air quality data, pollen, evapotranspiration, autocomplete, time zone, astronomy and sports data into your new or existing project.