> For the complete documentation index, see [llms.txt](https://encrisoft.gitbook.io/alerta/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://encrisoft.gitbook.io/alerta/reference/api-reference/get-alerts.md).

# Get Alerts

<mark style="color:$info;">**(NOTE: this does not contain alerts content as we do not store alerts content due to compliance reasons)**</mark>

<mark style="color:green;">`GET`</mark> `https://api.usealerta.com/v1/alerts`

This endpoint help you get alerts based on status, from date,to date, type, page number or ,\
pageSize

#### Request Query

e.g `https://api.usealerta.com/v1/alerts?from=2024-06-20&to=2024-07-23`

| Name     | Type   | Description                                     |
| -------- | ------ | ----------------------------------------------- |
| status   | string | the status e.g 'success'                        |
| from     | date   | from date e.g yyyy-mm-dd                        |
| to       | date   | to date e.g yyyy-mm-dd                          |
| type     | string | the type of alerts, either 'message' or 'reply' |
| page     | number | the page number                                 |
| pageSize | number | number of items per page                        |

{% tabs %}
{% tab title="200 Message sent successfully" %}

```json
{
    "statusCode": 200,
    "message": "Alerts retrieved successfully",
    "data": {
        "data": [
            {
                "id": 4,
                "channelSentTo": "channel_name",
                "type": "reply",
                "reference": "ref",
                "status": "success",
                "createAt": "2024-07-18T14:30:03.688Z",
                "updatedAt": "2024-07-18T14:30:03.688Z"
            },
            {
                "id": 5,
                "channelSentTo": "channel_name",
                "type": "message",
                "reference": "ref",
                "status": "success",
                "createAt": "2024-07-16T15:48:34.040Z",
                "updatedAt": "2024-07-16T15:48:34.040Z"
            },
    
        ],
        "total": 2,
        "page": 1,
        "pageSize": 10,
        "prevPage": false,
        "nextPage": false,
        "totalPages": 1
    }
}
```

{% endtab %}

{% tab title="403 Forbidden request" %}

```json
{
    "statusCode": 403,
    "message": "Invalid API key",
    "error": "Forbidden"
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://encrisoft.gitbook.io/alerta/reference/api-reference/get-alerts.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
