Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Der Endpunkt forecast bietet stündliche Informationen zur Luftqualitätsvorhersage für einen bestimmten Standort für bis zu 96 Stunden (4 Tage). Jede Vorhersage enthält stündliche Luftqualitätsindizes sowie zusätzliche Informationen:
Bestimmte Uhrzeit und bestimmtes Datum oder Zeitraum für die Prognose
Sprachcode für übersetzte Felder
Lokaler oder benutzerdefinierter Luftqualitätsindex (LQI)
Gesundheitsempfehlungen
Dominante Schadstoffe
Schadstoffkonzentration
Weitere Informationen zu Schadstoffen
Größe der Antwortseite
Farbvorlage
Mit dem APIs Explorer können Sie Liveanfragen stellen, um sich mit der API und den API-Optionen vertraut zu machen:
Sie können stündliche Informationen zur Luftqualitätsprognose über den Prognoseendpunkt anfordern, indem Sie eine HTTP-POST-Anfrage an folgende Adresse senden:
Fügen Sie Ihre Parameter in den Anfragetext ein. Der Anfragebody enthält den Ort, für den Sie stündliche Vorhersageinformationen zur Luftqualität abrufen möchten, sowie verschiedene Optionen, mit denen Sie steuern können, welche zusätzlichen Informationen in die Antwort aufgenommen werden sollen.
Prognoseantworten
Der Antworttext enthält das UTC-Datum und die UTC-Uhrzeit, für die Informationen zur Vorhersage der Luftqualität, Luftqualitätsindizes und zusätzliche benutzerdefinierte Informationen angezeigt werden sollen. Der Antworttext enthält auch ein Token zum Abrufen der nächsten Seite, wenn die Informationen nicht in die angeforderte Seitengröße passen.
Beispiel für eine einfache Anfrage
Der folgende Code zeigt, wie eine Prognoseanfrage erstellt wird. In diesem Beispiel geben Sie den Ort, das Datum und die Uhrzeit (beginnend mit der nächsten Stunde bis zu 96 Stunden) an, für die stündliche Informationen zur Luftqualität angezeigt werden sollen.
{"hourlyForecasts":[{"dateTime":"2024-02-09T08:00:00Z","indexes":[{"code":"uaqi","displayName":"Universal AQI","aqi":80,"aqiDisplay":"80","color":{"red":0.34509805,"green":0.74509805,"blue":0.20784314},"category":"Excellent air quality","dominantPollutant":"pm25"}]}],"regionCode":"us"}
Beispiel für eine Anfrage mit mehreren Parametern
Im folgenden Code wird gezeigt, wie Sie einen Anfragebody mit mehreren Parametern erstellen. In diesem Beispiel geben Sie Folgendes an:
Standort
Zeitraum, für den Informationen zur Luftqualitätsvorhersage angezeigt werden sollen
Sprachcode
Zusätzliche Berechnungen (z. B. Gesundheitsempfehlungen, die Konzentration des dominanten Schadstoffs und zusätzliche Informationen zu Schadstoffen)
{{"hourlyForecasts":[{"dateTime":"2024-02-27T11:00:00Z","indexes":[{"code":"uaqi","displayName":"Universal AQI","aqi":75,"aqiDisplay":"75","color":{"red":0.43137255,"green":0.7764706,"blue":0.20392157},"category":"Good air quality","dominantPollutant":"pm25"}],"pollutants":[{"code":"pm25","displayName":"PM2.5","fullName":"Fine particulate matter (\u003c2.5µm)","concentration":{"value":15.1,"units":"MICROGRAMS_PER_CUBIC_METER"},"additionalInfo":{"sources":"...","effects":"..."}}],"healthRecommendations":{"generalPopulation":"...","lungDiseasePopulation":"...","heartDiseasePopulation":"...","athletes":"...","pregnantWomen":"..."}},{"dateTime":"2024-02-27T12:00:00Z","indexes":[{"code":"uaqi","displayName":"Universal AQI","aqi":67,"aqiDisplay":"67","color":{"red":0.5882353,"green":0.8392157,"blue":0.16862746},"category":"Good air quality","dominantPollutant":"pm25"}],"pollutants":[{"code":"pm25","displayName":"PM2.5","fullName":"Fine particulate matter (\u003c2.5µm)","concentration":{"value":19.96,"units":"MICROGRAMS_PER_CUBIC_METER"},"additionalInfo":{"sources":"...","effects":"..."}}],"healthRecommendations":{"generalPopulation":"...","lungDiseasePopulation":"...","heartDiseasePopulation":"...","athletes":"...","pregnantWomen":"...","children":"..."}},/.../]}"regionCode":"us","nextPageToken":"CjMKEglwCFVq9l5EQBH0aoDSUH9SwBoQCgYI1pDirgYSBgiGiOiuBiABKgMCBAMyAmVuOAEQGA=="}
Wenn Sie die nächste Seite mit Prognoseinformationen aufrufen möchten, übergeben Sie das nextPageToken, das am Ende des Antworttexts zurückgegeben wird:
Dadurch wird die nächste Seite mit Prognoseinformationen zurückgegeben:
{"hourlyForecasts":[{"dateTime":"2024-02-27T21:00:00Z","indexes":[{"code":"uaqi","displayName":"Universal AQI","aqi":74,"aqiDisplay":"74","color":{"red":0.44705883,"green":0.78431374,"blue":0.2},"category":"Good air quality","dominantPollutant":"o3"}],"pollutants":[{"code":"o3","displayName":"O3","fullName":"Ozone","concentration":{"value":32.07,"units":"PARTS_PER_BILLION"},"additionalInfo":{"sources":"...","effects":"..."}}],"healthRecommendations":{"generalPopulation":"...","elderly":"...","lungDiseasePopulation":"...","heartDiseasePopulation":"...","athletes":"...","pregnantWomen":"...","children":"..."}},{"dateTime":"2024-02-27T22:00:00Z","indexes":[{"code":"uaqi","displayName":"Universal AQI","aqi":75,"aqiDisplay":"75","color":{"red":0.43137255,"green":0.7764706,"blue":0.20392157},"category":"Good air quality","dominantPollutant":"o3"}],"pollutants":[{"code":"o3","displayName":"O3","fullName":"Ozone","concentration":{"value":30.94,"units":"PARTS_PER_BILLION"},"additionalInfo":{"sources":"...","effects":"..."}}],"healthRecommendations":{"generalPopulation":"...","lungDiseasePopulation":"...","heartDiseasePopulation":"...","athletes":"...","pregnantWomen":"...","children":"..."}},/.../]"regionCode":"us"}
Testen!
Mit dem APIs Explorer können Sie Beispielanfragen stellen, um sich mit der API und den API-Optionen vertraut zu machen.
Wählen Sie rechts auf der Seite das API-Symbol api aus.
Bearbeiten Sie optional die Anfrageparameter.
Klicken Sie auf die Schaltfläche Ausführen. Wählen Sie im Dialogfeld das Konto aus, das Sie für die Anfrage verwenden möchten.
Wählen Sie im Bereich „APIs Explorer“ das Symbol für den Vollbildmodus fullscreen aus, um das APIs Explorer-Fenster zu maximieren.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Benötigte Informationen nicht gefunden","missingTheInformationINeed","thumb-down"],["Zu umständlich/zu viele Schritte","tooComplicatedTooManySteps","thumb-down"],["Nicht mehr aktuell","outOfDate","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Problem mit Beispielen/Code","samplesCodeIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-08-31 (UTC)."],[[["\u003cp\u003eThe Air Quality API's forecast endpoint provides hourly air quality forecasts for up to 96 hours (4 days) for a specified location.\u003c/p\u003e\n"],["\u003cp\u003eForecast data includes air quality indexes, dominant pollutants, health recommendations, pollutant concentrations, and more.\u003c/p\u003e\n"],["\u003cp\u003eRequests are made via HTTP POST to the endpoint with parameters specifying location, time, and optional data inclusions.\u003c/p\u003e\n"],["\u003cp\u003eResponses contain hourly forecast data, potentially paginated, with a token for retrieving subsequent pages if necessary.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can customize requests to include specific language codes, color palettes, and additional computations for a tailored response.\u003c/p\u003e\n"]]],[],null,["The [`forecast`](/maps/documentation/air-quality/reference/rest/v1/forecast/lookup) endpoint\nprovides up to 96 hours (4 days) of hourly air\nquality forecast information for a given location. Each forecast includes hourly\nair quality indexes as well as additional information:\n\n- Specific time and date or time period for forecast\n- Language code for translated fields\n- Local or custom air quality index (AQI)\n- Health recommendations\n- Dominant pollutants\n- Pollutant concentration\n- Additional information about pollutants\n- Response page size\n- Color palette\n\nThe APIs Explorer lets you make live requests so that you can get familiar with\nthe API and the API options: \n[Try it!](#try_it)\n| To get air quality forecasts, set the `dateTime` parameter to a future date and time, as shown in the [basic\n| request example](/maps/documentation/air-quality/forecast#example_of_basic_request) below.\n\nAbout forecast requests\n\nYou can request hourly air quality forecast information using the\nforecast endpoint by sending an HTTP POST request to: \n\n```html\nhttps://airquality.googleapis.com/v1/forecast:lookup?key=YOUR_API_KEY\n```\n\nInclude your\n[parameters](/maps/documentation/air-quality/reference/rest/v1/forecast/lookup#request-body)\nin the request body. The request body contains the location for which you would\nlike to get air quality hourly forecast information and various options to\ncontrol what additional information to include in the response.\n\nAbout forecast responses\n\nThe response body provides the UTC date and time for which to display air\nquality forecast information, air quality indexes, and additional customized\ninformation. The response body also includes a token to retrieve the next page\nif the information does not fit within the requested page size.\n\nExample of basic request\n\nThe following code shows how to construct a forecast request. In this example,\nyou specify the location, date and time (beginning from the next hour up to 96\nhours) for which to show hourly air quality forecast information. \n\n```bash\ncurl -X POST -d '{\n \"location\": {\n \"latitude\": 37.4125333,\n \"longitude\": -122.0840937\n },\n \"dateTime\": \"2024-02-09T08:00:00Z\"\n}' \\\n-H \"Content-Type: application/json\" \\\n-H \"Accept-Language: *\" \\\n\"https://airquality.googleapis.com/v1/forecast:lookup?key=YOUR_API_KEY\"\n```\n\nThe call generates the following JSON response. \n\n```json\n{\n \"hourlyForecasts\": [\n {\n \"dateTime\": \"2024-02-09T08:00:00Z\",\n \"indexes\": [\n {\n \"code\": \"uaqi\",\n \"displayName\": \"Universal AQI\",\n \"aqi\": 80,\n \"aqiDisplay\": \"80\",\n \"color\": {\n \"red\": 0.34509805,\n \"green\": 0.74509805,\n \"blue\": 0.20784314\n },\n \"category\": \"Excellent air quality\",\n \"dominantPollutant\": \"pm25\"\n }\n ]\n }\n ],\n \"regionCode\": \"us\"\n}\n```\n| **Note:** If a `color` field value is `0`, that field is omitted from the response.\n\nExample of request with multiple parameters\n\nThe following code shows how to construct a request body with multiple\nparameters. In this example, you specify the following:\n\n- Location\n- Time period for which to display air quality forecast information\n- Language code\n- Extra computations (such as health recommendations, the dominant pollutant concentration, and additional pollutant information)\n- Color palette\n\n```bash\ncurl -X POST -d '{\n \"pageSize\": \"10\",\n \"universalAqi\": \"true\",\n \"location\": {\n \"latitude\": \"40.741895\",\n \"longitude\": \"-73.989308\"\n },\n \"period\": {\n \"startTime\": \"2024-02-27T13:58:14+02:00\",\n \"endTime\": \"2024-02-28T16:58:14+02:00\"\n },\n \"languageCode\": \"en\",\n \"extraComputations\": [\n \"HEALTH_RECOMMENDATIONS\",\n \"DOMINANT_POLLUTANT_CONCENTRATION\",\n \"POLLUTANT_ADDITIONAL_INFO\"\n ],\n \"uaqiColorPalette\": \"RED_GREEN\"\n}' \\\n-H \"Content-Type: application/json\" \\\n-H \"Accept-Language: *\" \\\n\"https://airquality.googleapis.com/v1/forecast:lookup?key=YOUR_API_KEY\"\n```\n\nThe call generates the following JSON response. \n\n```json\n{\n {\n \"hourlyForecasts\": [\n {\n \"dateTime\": \"2024-02-27T11:00:00Z\",\n \"indexes\": [\n {\n \"code\": \"uaqi\",\n \"displayName\": \"Universal AQI\",\n \"aqi\": 75,\n \"aqiDisplay\": \"75\",\n \"color\": {\n \"red\": 0.43137255,\n \"green\": 0.7764706,\n \"blue\": 0.20392157\n },\n \"category\": \"Good air quality\",\n \"dominantPollutant\": \"pm25\"\n }\n ],\n \"pollutants\": [\n {\n \"code\": \"pm25\",\n \"displayName\": \"PM2.5\",\n \"fullName\": \"Fine particulate matter (\\u003c2.5µm)\",\n \"concentration\": {\n \"value\": 15.1,\n \"units\": \"MICROGRAMS_PER_CUBIC_METER\"\n },\n \"additionalInfo\": {\n \"sources\": \"...\",\n \"effects\": \"...\"\n }\n }\n ],\n \"healthRecommendations\": {\n \"generalPopulation\": \"...\",\n \"lungDiseasePopulation\": \"...\",\n \"heartDiseasePopulation\": \"...\",\n \"athletes\": \"...\",\n \"pregnantWomen\": \"...\"\n }\n },\n {\n \"dateTime\": \"2024-02-27T12:00:00Z\",\n \"indexes\": [\n {\n \"code\": \"uaqi\",\n \"displayName\": \"Universal AQI\",\n \"aqi\": 67,\n \"aqiDisplay\": \"67\",\n \"color\": {\n \"red\": 0.5882353,\n \"green\": 0.8392157,\n \"blue\": 0.16862746\n },\n \"category\": \"Good air quality\",\n \"dominantPollutant\": \"pm25\"\n }\n ],\n \"pollutants\": [\n {\n \"code\": \"pm25\",\n \"displayName\": \"PM2.5\",\n \"fullName\": \"Fine particulate matter (\\u003c2.5µm)\",\n \"concentration\": {\n \"value\": 19.96,\n \"units\": \"MICROGRAMS_PER_CUBIC_METER\"\n },\n \"additionalInfo\": {\n \"sources\": \"...\",\n \"effects\": \"...\"\n }\n }\n ],\n \"healthRecommendations\": {\n \"generalPopulation\": \"...\",\n \"lungDiseasePopulation\": \"...\",\n \"heartDiseasePopulation\": \"...\",\n \"athletes\": \"...\",\n \"pregnantWomen\": \"...\",\n \"children\": \"...\"\n }\n },\n /.../\n ]\n }\n \"regionCode\": \"us\",\n \"nextPageToken\": \"CjMKEglwCFVq9l5EQBH0aoDSUH9SwBoQCgYI1pDirgYSBgiGiOiuBiABKgMCBAMyAmVuOAEQGA==\"\n}\n```\n\nTo view the next page of forecast information, pass in the `nextPageToken`\nreturned at the end of the response body: \n\n```bash\ncurl -X POST -d '{\n \"universalAqi\": \"true\",\n \"location\": {\n \"latitude\": \"40.741895\",\n \"longitude\": \"-73.989308\"\n },\n \"period\": {\n \"startTime\": \"2024-02-27T13:58:14+02:00\",\n \"endTime\": \"2024-02-28T16:58:14+02:00\"\n },\n \"languageCode\": \"en\",\n \"extraComputations\": [\n \"HEALTH_RECOMMENDATIONS\",\n \"DOMINANT_POLLUTANT_CONCENTRATION\",\n \"POLLUTANT_ADDITIONAL_INFO\"\n ],\n \"uaqiColorPalette\": \"RED_GREEN\",\n \"pageToken\": \"CjMKEglwCFVq9l5EQBH0aoDSUH9SwBoQCgYI1pDirgYSBgiGiOiuBiABKgMCBAMyAmVuOAEQGA==\"\n}' \\\n-H \"Content-Type: application/json\" \\\n-H \"Accept-Language: *\" \\\n\"https://airquality.googleapis.com/v1/forecast:lookup?key=YOUR_API_KEY\"\n```\n\nThis returns the next page of forecast information: \n\n```json\n{\n \"hourlyForecasts\": [\n {\n \"dateTime\": \"2024-02-27T21:00:00Z\",\n \"indexes\": [\n {\n \"code\": \"uaqi\",\n \"displayName\": \"Universal AQI\",\n \"aqi\": 74,\n \"aqiDisplay\": \"74\",\n \"color\": {\n \"red\": 0.44705883,\n \"green\": 0.78431374,\n \"blue\": 0.2\n },\n \"category\": \"Good air quality\",\n \"dominantPollutant\": \"o3\"\n }\n ],\n \"pollutants\": [\n {\n \"code\": \"o3\",\n \"displayName\": \"O3\",\n \"fullName\": \"Ozone\",\n \"concentration\": {\n \"value\": 32.07,\n \"units\": \"PARTS_PER_BILLION\"\n },\n \"additionalInfo\": {\n \"sources\": \"...\",\n \"effects\": \"...\"\n }\n }\n ],\n \"healthRecommendations\": {\n \"generalPopulation\": \"...\",\n \"elderly\": \"...\",\n \"lungDiseasePopulation\": \"...\",\n \"heartDiseasePopulation\": \"...\",\n \"athletes\": \"...\",\n \"pregnantWomen\": \"...\",\n \"children\": \"...\"\n }\n },\n {\n \"dateTime\": \"2024-02-27T22:00:00Z\",\n \"indexes\": [\n {\n \"code\": \"uaqi\",\n \"displayName\": \"Universal AQI\",\n \"aqi\": 75,\n \"aqiDisplay\": \"75\",\n \"color\": {\n \"red\": 0.43137255,\n \"green\": 0.7764706,\n \"blue\": 0.20392157\n },\n \"category\": \"Good air quality\",\n \"dominantPollutant\": \"o3\"\n }\n ],\n \"pollutants\": [\n {\n \"code\": \"o3\",\n \"displayName\": \"O3\",\n \"fullName\": \"Ozone\",\n \"concentration\": {\n \"value\": 30.94,\n \"units\": \"PARTS_PER_BILLION\"\n },\n \"additionalInfo\": {\n \"sources\": \"...\",\n \"effects\": \"...\"\n }\n }\n ],\n \"healthRecommendations\": {\n \"generalPopulation\": \"...\",\n \"lungDiseasePopulation\": \"...\",\n \"heartDiseasePopulation\": \"...\",\n \"athletes\": \"...\",\n \"pregnantWomen\": \"...\",\n \"children\": \"...\"\n }\n },\n /.../\n ]\n \"regionCode\": \"us\"\n}\n```\n\nTry it!\n\nThe APIs Explorer lets you make sample requests so\nthat you can get familiar with the API and the API options.\n\n1. Select the API icon api\n on the right side of the page.\n\n2. Optionally edit the request parameters.\n\n3. Select the **Execute** button. In the dialog, choose the account\n that you want to use to make the request.\n\n4. In the APIs Explorer panel, select the fullscreen icon\n fullscreen to expand the APIs Explorer window."]]