Source: https://datafa.st/docs/api/account/alerts/history
Markdown source: https://datafa.st/docs/api/account/alerts/history.md
Description: Get recent alert trigger logs. Supports alertId and limit query parameters.

# Get alert history

`GET https://datafa.st/api/v1/admin/websites/{websiteId}/alerts/history`

Get recent alert trigger logs. Supports alertId and limit query parameters.

## Request

### Authentication

- `dft_` account token with `alerts:read`.


### Path parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `websiteId` | string | Website ObjectId used by account tokens to choose which website to query or manage. Website ObjectId. The caller token must have access to this website. |

### Query parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `alertId` | string | No | Filter history to one alert ObjectId. |
| `limit` | number | No | Maximum number of rows returned in one response. Use with `offset` to paginate through long result sets. Maximum logs returned. Defaults to 50, capped at 100. |

## Response

Returns a JSON object with `status` and endpoint-specific fields.

### Response fields

| Field | Type | Description |
| --- | --- | --- |
| `data[].alertId` | string | Alert ObjectId. |
| `data[].alertName` | string | Alert name. |
| `data[].goalName` | string | Goal that triggered the alert. |
| `data[].status` | string | `sent` or failed status. |
| `data[].error` | string|null | Error message when delivery failed. |
| `data[].visitorId` | string|null | Alias for `datafast_visitor_id` on endpoints that accept both names. |
| `data[].triggeredAt` | string | Trigger timestamp. |
| `counts.sent` | number | Number of sent logs before limit slicing. |
| `counts.failed` | number | Number of failed logs before limit slicing. |
| `counts.total` | number | Total logs before limit slicing. |

### Errors

Common errors include `400` for invalid input, `401` for missing or invalid tokens, `403` for missing permissions or website access, `404` for missing resources, and `500` for server errors.

## Code examples

### Example request

```bash
curl -X GET "https://datafa.st/api/v1/admin/websites/{websiteId}/alerts/history" \
  -H "Authorization: Bearer dft_xxx"
```

### Success response

```json
{
  "status": "success",
  "data": [{
    "alertId": "665f0b3c4d2e1a0012345678",
    "alertName": "New signup",
    "goalName": "signup",
    "status": "sent",
    "error": null,
    "visitorId": "a3ab2331-989f-4cfa-91c6-2461c9e3c6bd",
    "triggeredAt": "2026-05-21T00:00:00.000Z"
  }],
  "counts": { "sent": 1, "failed": 0, "total": 1 }
}
```
