Get hourly forecast

The forecast.hours endpoint returns up to 240 hours of forecast information for a specific location, starting at the current hour. The API returns the following:

  • A description of the current weather conditions with a corresponding icon
  • Current temperature
  • Apparent ("feels like") temperature
  • Dew point
  • Heat index
  • Wind chill
  • Wet bulb temperature
  • Relative humidity
  • UV index
  • Probability, percentage, and type of precipitation
  • Probability of thunderstorms
  • Sea level pressure
  • Wind direction, speed, and gust
  • Visibility and cloud cover

About hourly forecast requests

To request hourly forecast information, send an HTTP GET request to:

https://weather.googleapis.com/v1/forecast/hours:lookup?key=YOUR_API_KEY&location.latitude=LATITUDE&location.longitude=LONGITUDE

Include the latitude and longitude coordinates of the location in your request URL parameters.

Hourly forecast request examples

By default, the forecast.hours endpoint returns 240 hours of data, starting from the current hour. You can scope your request to a particular time period using the hours parameter.

The following example requests hourly forecast information for the next three hours for Mountain View, CA:

curl -X GET "https://weather.googleapis.com/v1/forecast/hours:lookup?key=YOUR_API_KEY&location.latitude=37.4220&location.longitude=-122.0841&hours=3"

In the response, the interval object indicates each hour of information:

{
  "forecastHours": [
    {
      "interval": {
        "startTime": "2025-02-05T23:00:00Z",
        "endTime": "2025-02-06T00:00:00Z"
      },
      "displayDateTime": {
        "year": 2025,
        "month": 2,
        "day": 5,
        "hours": 15,
        "utcOffset": "-28800s"
      },
      "isDaytime": true,
      "weatherCondition": {
        "iconBaseUri": "https://maps.gstatic.com/weather/v1/sunny",
        "description": {
          "text": "Sunny",
          "languageCode": "en"
        },
        "type": "CLEAR"
      },
      "temperature": {
        "degrees": 12.7,
        "unit": "CELSIUS"
      },
      "feelsLikeTemperature": {
        "degrees": 12,
        "unit": "CELSIUS"
      },
      "dewPoint": {
        "degrees": 2.7,
        "unit": "CELSIUS"
      },
      "heatIndex": {
        "degrees": 12.7,
        "unit": "CELSIUS"
      },
      "windChill": {
        "degrees": 12,
        "unit": "CELSIUS"
      },
      "wetBulbTemperature": {
        "degrees": 7.7,
        "unit": "CELSIUS"
      },
      "relativeHumidity": 51,
      "uvIndex": 1,
      "precipitation": {
        "probability": {
          "percent": 0,
          "type": "RAIN"
        },
        "qpf": {
          "quantity": 0,
          "unit": "MILLIMETERS"
        }
      },
      "thunderstormProbability": 0,
      "airPressure": {
        "meanSeaLevelMillibars": 1019.13
      },
      "wind": {
        "direction": {
          "degrees": 335,
          "cardinal": "NORTH_NORTHWEST"
        },
        "speed": {
          "value": 10,
          "unit": "KILOMETERS_PER_HOUR"
        },
        "gust": {
          "value": 19,
          "unit": "KILOMETERS_PER_HOUR"
        }
      },
      "visibility": {
        "distance": 16,
        "unit": "KILOMETERS"
      },
      "cloudCover": 0,
      "iceThickness": {
        "thickness": 0,
        "unit": "MILLIMETERS"
      }
    },
    {
      "interval": {
        "startTime": "2025-02-06T00:00:00Z",
        "endTime": "2025-02-06T01:00:00Z"
      },
      "displayDateTime": {
        "year": 2025,
        "month": 2,
        "day": 5,
        "hours": 16,
        "utcOffset": "-28800s"
      },
      "isDaytime": true,
      "weatherCondition": {
        "iconBaseUri": "https://maps.gstatic.com/weather/v1/sunny",
        "description": {
          "text": "Sunny",
          "languageCode": "en"
        },
        "type": "CLEAR"
      },
      "temperature": {
        "degrees": 12.5,
        "unit": "CELSIUS"
      },
      /.../
    },
    {
      "interval": {
        "startTime": "2025-02-06T01:00:00Z",
        "endTime": "2025-02-06T02:00:00Z"
      },
      "displayDateTime": {
        "year": 2025,
        "month": 2,
        "day": 5,
        "hours": 17,
        "utcOffset": "-28800s"
      },
      "isDaytime": true,
      "weatherCondition": {
        "iconBaseUri": "https://maps.gstatic.com/weather/v1/sunny",
        "description": {
          "text": "Sunny",
          "languageCode": "en"
        },
        "type": "CLEAR"
      },
      "temperature": {
        "degrees": 11.4,
        "unit": "CELSIUS"
      },
      /.../
    }
  ],
  "timeZone": {
    "id": "America/Los_Angeles"
  }
}

Specify number of hours to return per page

You can specify the number of hours of data to return per page using the pageSize URL parameter. The default value is 24 hours of forecast information per page.

Responses with multiple pages of information include a nextPageToken. To view the next page of information, pass the nextPageToken value into the pageToken parameter in your request.

The following example requests 25 hours of weather forecast data for Mountain View, CA, with three hours of data per page:

curl -X GET "https://weather.googleapis.com/v1/forecast/hours:lookup?key=YOUR_API_KEY&location.latitude=37.4220&location.longitude=-122.0841&hours=25&pageSize=3"

The response, which includes the first three hours of data, is in the form:

{
  "forecastHours": [
    {
      "interval": {
        "startTime": "2025-02-06T23:00:00Z",
        "endTime": "2025-02-07T00:00:00Z"
      },
      "displayDateTime": {
        "year": 2025,
        "month": 2,
        "day": 6,
        "hours": 15,
        "utcOffset": "-28800s"
      },
      "isDaytime": true,
      "weatherCondition": {
        "iconBaseUri": "https://maps.gstatic.com/weather/v1/showers",
        "description": {
          "text": "Rain showers",
          "languageCode": "en"
        },
        "type": "RAIN_SHOWERS"
      },
      "temperature": {
        "degrees": 14.6,
        "unit": "CELSIUS"
      },
      /.../
    },
    {
      "interval": {
        "startTime": "2025-02-07T00:00:00Z",
        "endTime": "2025-02-07T01:00:00Z"
      },
      "displayDateTime": {
        "year": 2025,
        "month": 2,
        "day": 6,
        "hours": 16,
        "utcOffset": "-28800s"
      },
      "isDaytime": true,
      "weatherCondition": {
        "iconBaseUri": "https://maps.gstatic.com/weather/v1/drizzle",
        "description": {
          "text": "Light rain",
          "languageCode": "en"
        },
        "type": "LIGHT_RAIN"
      },
      "temperature": {
        "degrees": 14.4,
        "unit": "CELSIUS"
      },
      /.../
    },
    {
      "interval": {
        "startTime": "2025-02-07T01:00:00Z",
        "endTime": "2025-02-07T02:00:00Z"
      },
      "displayDateTime": {
        "year": 2025,
        "month": 2,
        "day": 6,
        "hours": 17,
        "utcOffset": "-28800s"
      },
      "isDaytime": true,
      "weatherCondition": {
        "iconBaseUri": "https://maps.gstatic.com/weather/v1/cloudy",
        "description": {
          "text": "Cloudy",
          "languageCode": "en"
        },
        "type": "CLOUDY"
      },
      "temperature": {
        "degrees": 14.4,
        "unit": "CELSIUS"
      },
      /.../
    }
  ],
  "timeZone": {
    "id": "America/Los_Angeles"
  },
  "nextPageToken": "ChYKEgm8dJMYBLZCQBH-ZffkYYVewBAZEAMYAyIMCLKClb0GEJeO18kDKhNBbWVyaWNhL0xvc19BbmdlbGVz"
}

To access the next page of data, pass the nextPageToken value into the pageToken parameter in your request:

curl -X GET "https://weather.googleapis.com/v1/forecast/hours:lookup?key=YOUR_API_KEY&location.latitude=37.4220&location.longitude=-122.0841&hours=25&pageSize=3&pageToken=ChYKEgm8dJMYBLZCQBH-ZffkYYVewBAZEAMYAyIMCLKClb0GEJeO18kDKhNBbWVyaWNhL0xvc19BbmdlbGVz"

The response is in the form:

{
  "forecastHours": [
    {
      "interval": {
        "startTime": "2025-02-07T02:00:00Z",
        "endTime": "2025-02-07T03:00:00Z"
      },
      "displayDateTime": {
        "year": 2025,
        "month": 2,
        "day": 6,
        "hours": 18,
        "utcOffset": "-28800s"
      },
      "isDaytime": false,
      "weatherCondition": {
        "iconBaseUri": "https://maps.gstatic.com/weather/v1/cloudy",
        "description": {
          "text": "Cloudy",
          "languageCode": "en"
        },
        "type": "CLOUDY"
      },
      "temperature": {
        "degrees": 14.3,
        "unit": "CELSIUS"
      },
      /.../
    },
    {
      "interval": {
        "startTime": "2025-02-07T03:00:00Z",
        "endTime": "2025-02-07T04:00:00Z"
      },
      "displayDateTime": {
        "year": 2025,
        "month": 2,
        "day": 6,
        "hours": 19,
        "utcOffset": "-28800s"
      },
      "isDaytime": false,
      "weatherCondition": {
        "iconBaseUri": "https://maps.gstatic.com/weather/v1/showers",
        "description": {
          "text": "Rain showers",
          "languageCode": "en"
        },
        "type": "RAIN_SHOWERS"
      },
      "temperature": {
        "degrees": 14.2,
        "unit": "CELSIUS"
      },
      /.../
    },
    {
      "interval": {
        "startTime": "2025-02-07T04:00:00Z",
        "endTime": "2025-02-07T05:00:00Z"
      },
      "displayDateTime": {
        "year": 2025,
        "month": 2,
        "day": 6,
        "hours": 20,
        "utcOffset": "-28800s"
      },
      "isDaytime": false,
      "weatherCondition": {
        "iconBaseUri": "https://maps.gstatic.com/weather/v1/showers",
        "description": {
          "text": "Rain showers",
          "languageCode": "en"
        },
        "type": "RAIN_SHOWERS"
      },
      "temperature": {
        "degrees": 14.1,
        "unit": "CELSIUS"
      },
      /.../
    }
  ],
  "timeZone": {
    "id": "America/Los_Angeles"
  },
  "nextPageToken": "ChYKEgm8dJMYBLZCQBH-ZffkYYVewBAZEAYYBiILCPeDlb0GEICs5TMqE0FtZXJpY2EvTG9zX0FuZ2VsZXM="
}