# Forecasts

Uncover the power of our Forecast API through the following endpoints:

## 1. Daily Forecasts

Access daily air quality forecasts based on device or site IDs.

### 1.1 Using the Device ID, get the daily forecast&#x20;

<mark style="color:blue;">`GET`</mark> `https://api.airqo.net/api/v2/predict/daily-forecast?device_id={device_id}`

Retrieve daily air quality forecasts

#### Query Parameters

| Name                                    | Type   | Description                               |
| --------------------------------------- | ------ | ----------------------------------------- |
| token<mark style="color:red;">\*</mark> | string | the security token                        |
| device\_id                              | string | An string which represents the device\_id |
| site\_id                                | String | An string which represents the site\_id   |

{% tabs %}
{% tab title="200 " %}

```
{
  "forecasts": [
    {
      "health_tips:[],
      "pm2_5": 38.00850069695176,
      "time": "2023-12-01 00:00:00+00:00"
    },
     {
      "health_tips:[],
      "pm2_5": 38.00850069695176,
      "time": "2023-12-01 00:00:00+00:00"
    },
     {
      "health_tips:[],
      "pm2_5": 38.00850069695176,
      "time": "2023-12-01 00:00:00+00:00"
    },
]
}
```

{% endtab %}

{% tab title="401: Unauthorized In case of bad requests" %}

```
{"success":false, "message":"Invalid authentication", "error":"Unauthorized."}
```

{% endtab %}
{% endtabs %}

### 1.2 Using the Site ID, get Daily Forecast&#x20;

<mark style="color:blue;">`GET`</mark> `https://api.airqo.net/api/v2/predict/daily-forecast?site_id={site_id}`

Retrieve daily air quality forecasts

#### Query Parameters

| Name                                    | Type   | Description                               |
| --------------------------------------- | ------ | ----------------------------------------- |
| token<mark style="color:red;">\*</mark> | string | the security token                        |
| device\_id                              | string | An string which represents the device\_id |
| site\_id                                | String | An string which represents the site\_id   |

{% tabs %}
{% tab title="200 " %}

```
{
  "forecasts": [
    {
      "health_tips:[],
      "pm2_5": 38.00850069695176,
      "time": "2023-12-01 00:00:00+00:00"
    },
     {
      "health_tips:[],
      "pm2_5": 38.00850069695176,
      "time": "2023-12-01 00:00:00+00:00"
    },
     {
      "health_tips:[],
      "pm2_5": 38.00850069695176,
      "time": "2023-12-01 00:00:00+00:00"
    },
]
}
```

{% endtab %}

{% tab title="401: Unauthorized In case of bad requests" %}

```
{"success":false, "message":"Invalid authentication", "error":"Unauthorized."}
```

{% endtab %}
{% endtabs %}

## 2. Hourly Forecasts

Retrieve hourly air quality forecasts using device or site IDs.

### 2.1 Using the Device ID, get Hourly Forecast

<mark style="color:blue;">`GET`</mark> `https://api.airqo.net/api/v2/predict/hourly-forecast?device_id={device_id}`

Retrieve hourly air quality forecasts

#### Query Parameters

| Name                                    | Type   | Description                               |
| --------------------------------------- | ------ | ----------------------------------------- |
| token<mark style="color:red;">\*</mark> | string | the security token                        |
| site\_id                                | string | An string which represents the site\_id   |
| device\_id                              | String | An string which represents the device\_id |

{% tabs %}
{% tab title="200 " %}

```
{
  "forecasts": [
    {
      "health_tips:[],
      "pm2_5": 38.00850069695176,
      "time": "2023-12-01 00:00:00+00:00"
    },
     {
      "health_tips:[],
      "pm2_5": 38.00850069695176,
      "time": "2023-12-01 00:00:00+00:00"
    },
     {
      "health_tips:[],
      "pm2_5": 38.00850069695176,
      "time": "2023-12-01 00:00:00+00:00"
    },
]
}
```

{% endtab %}

{% tab title="401: Unauthorized In case of bad requests" %}

```
{"success":false, "message":"Invalid authentication", "error":"Unauthorized."}
```

{% endtab %}
{% endtabs %}

### 2.2 Using the Site ID, get Hourly Forecast

<mark style="color:blue;">`GET`</mark> `https://api.airqo.net/api/v2/predict/hourly-forecast?site_id={site_id}`

Retrieve hourly air quality forecasts

#### Query Parameters

| Name                                    | Type   | Description                               |
| --------------------------------------- | ------ | ----------------------------------------- |
| token<mark style="color:red;">\*</mark> | string | the security token                        |
| site\_id                                | string | An string which represents the site\_id   |
| device\_id                              | String | An string which represents the device\_id |

{% tabs %}
{% tab title="200 " %}

```
{
  "forecasts": [
    {
      "health_tips:[],
      "pm2_5": 38.00850069695176,
      "time": "2023-12-01 00:00:00+00:00"
    },
     {
      "health_tips:[],
      "pm2_5": 38.00850069695176,
      "time": "2023-12-01 00:00:00+00:00"
    },
     {
      "health_tips:[],
      "pm2_5": 38.00850069695176,
      "time": "2023-12-01 00:00:00+00:00"
    },
]
}
```

{% endtab %}

{% tab title="401: Unauthorized In case of bad requests" %}

```
{"success":false, "message":"Invalid authentication", "error":"Unauthorized."}
```

{% endtab %}
{% endtabs %}

## Usage Instructions

Incorporate our Forecast API into your applications effortlessly. Follow the guidelines in each section to make requests and receive precise daily and hourly forecasts for your specified devices or sites. Plan ahead with confidence, utilising our accurate predictions for proactive decision-making.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.airqo.net/airqo-rest-api-documentation/api-endpoints/forecasts.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
