---
title: "Daily forecast"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.npibase.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Daily forecast

Path: Weather API › Forecasts

`GET /forecasts`

URL: `https://api.weather.example/v1/forecasts`

Up to 14 days of forecasts for a location, starting today in its time zone.

## Authentication

- `bearer`, http bearer, header `Authorization`

## Query parameters

- `location_id` (`getDailyForecast.query.location_id`; string, required)
- `days` (`getDailyForecast.query.days`; integer, optional)
  - maximum: `14` · minimum: `1` · default: `7`
- `units` (`getDailyForecast.query.units`; string, optional)
  - one of `"metric"`, `"imperial"` · default: `"metric"`

## Code samples

### cURL

```bash
curl --request GET \
  --url 'https://api.weather.example/v1/forecasts?location_id=string' \
  --header 'Authorization: Bearer <token>'
```

### TypeScript

```typescript
const url = 'https://api.weather.example/v1/forecasts?location_id=string';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.weather.example/v1/forecasts?location_id=string"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)
```

## Responses

### 200

One entry per day.

#### Example

```json
{
  "location_id": "string",
  "days": [
    {
      "date": "2019-08-24",
      "temperature_max": 0,
      "temperature_min": 0,
      "precipitation_probability": 100,
      "summary": "Sunny spells"
    }
  ]
}
```

- `location_id` (`getDailyForecast.response.200.location_id`; string, required)
- `days` (`getDailyForecast.response.200.days`; array of object, required)
  - `date` (`getDailyForecast.response.200.days.date`; string, required)
    - format: `date`
  - `temperature_max` (`getDailyForecast.response.200.days.temperature_max`; number, required)
  - `temperature_min` (`getDailyForecast.response.200.days.temperature_min`; number, required)
  - `summary` (`getDailyForecast.response.200.days.summary`; string, required)
  - `precipitation_probability` (`getDailyForecast.response.200.days.precipitation_probability`; integer, optional)
    - maximum: `100` · minimum: `0`

### 404

Nothing exists at that id.

#### Example

```json
{
  "code": "not_found",
  "message": "string"
}
```

- `code` (`getDailyForecast.response.404.code`; string, required)
- `message` (`getDailyForecast.response.404.message`; string, required)


Source: https://docs.npibase.com/api/forecasts/list/index.md
