---
title: "List alerts"
---

> 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.

# List alerts

Path: Weather API › Alerts

`GET /alerts`

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

Active alerts, most severe first.

## Authentication

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

## Query parameters

- `severity` (`listAlerts.query.severity`; string, optional)
  - one of `"minor"`, `"moderate"`, `"severe"`, `"extreme"`

## Code samples

### cURL

```bash
curl --request GET \
  --url https://api.weather.example/v1/alerts \
  --header 'Authorization: Bearer <token>'
```

### TypeScript

```typescript
const url = 'https://api.weather.example/v1/alerts';
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/alerts"

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

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

print(response.text)
```

## Responses

### 200

Active alerts.

#### Example

```json
{
  "data": [
    {
      "id": "string",
      "headline": "Heat warning for the Lisbon district",
      "severity": "minor",
      "starts_at": "2019-08-24T14:15:22Z",
      "ends_at": "2019-08-24T14:15:22Z"
    }
  ]
}
```

- `data` (`listAlerts.response.200.data`; array of object, required)
  - `id` (`listAlerts.response.200.data.id`; string, required)
  - `headline` (`listAlerts.response.200.data.headline`; string, required)
  - `severity` (`listAlerts.response.200.data.severity`; string, required)
    - one of `"minor"`, `"moderate"`, `"severe"`, `"extreme"`
  - `starts_at` (`listAlerts.response.200.data.starts_at`; string, required)
    - format: `date-time`
  - `ends_at` (`listAlerts.response.200.data.ends_at`; string, optional)
    - format: `date-time`


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