# Retrieve Alerts for the Authenticated User or Company

- **Default**: Returns only alerts owned by the authenticated user
- **Company-wide**: Users with `external-api-get-all-company-alerts` permission can view all authenticated user company alerts

Results are sorted by creation date (newest first). Returns an empty list with 200 OK if no alerts exist.

## Endpoint
- **URL**: `https://api.genlogs.io/alerts`
- **Method**: `GET`

## Authentication
Requires Bearer token with one of these permissions:

| Permission                                   | Access                      |
|----------------------------------------------|-----------------------------|
| `external-api-get-alerts-endpoint`          | View own alerts             |
| `external-api-get-all-company-alerts`       | View all company alerts     |

## Headers

| Header            | Type   | Required | Description         |
|-------------------|--------|----------|---------------------|
| Authorization      | string | Yes      | Bearer token        |

## Request Example

```bash
curl -X GET "https://api.genlogs.io/alerts" \
  -H "Access-Token: YOUR_ACCESS_TOKEN" \
  -H "x-api-key: YOUR_API_KEY"
```

## Response (200 OK)

```json
{
  "alerts": [
    {
      "id": 35054,
      "disabled": false,
      "alert_name": "Trailer Tracking",
      "email": "user@company.com",
      "cc_emails": null,
      "start_date": "2026-01-19T05:00:00",
      "end_date": "2026-01-19T05:00:00",
      "location_state": null,
      "location_city": null,
      "license_plate": null,
      "license_plate_state": null,
      "usdot_number": null,
      "mc_number": null,
      "chassis_number": null,
      "container_number": null,
      "exact_match_chassis_number": false,
      "exact_match_container_number": false,
      "vin": null,
      "cab_number": null,
      "equipment_type": null,
      "trailer_logo": null,
      "trailer_number": null,
      "alert_type": "hot",
      "exact_match_trailer_number": false,
      "deep_search": "fx",
      "exact_match_deep_search": false,
      "notification_channels": ["WEBHOOK", "EMAIL"],
      "create_date": "2026-01-19T13:00:39.177379"
    },
    {
      "id": 34547,
      "disabled": false,
      "alert_name": "Fleet Monitor",
      "email": "user@company.com",
      "cc_emails": null,
      "start_date": "2025-11-01T00:00:00",
      "end_date": "2025-11-01T00:00:00",
      "location_state": null,
      "location_city": null,
      "license_plate": null,
      "license_plate_state": null,
      "usdot_number": null,
      "mc_number": null,
      "chassis_number": null,
      "container_number": null,
      "exact_match_chassis_number": null,
      "exact_match_container_number": null,
      "vin": null,
      "cab_number": null,
      "equipment_type": null,
      "trailer_logo": null,
      "trailer_number": null,
      "alert_type": "normal",
      "exact_match_trailer_number": false,
      "deep_search": "az",
      "exact_match_deep_search": false,
      "notification_channels": ["EMAIL"],
      "create_date": "2026-01-08T22:32:41.609945"
    }
  ]
}
```

## Response Fields

| Field                              | Type     | Description                                                   |
|------------------------------------|----------|---------------------------------------------------------------|
| id                                 | integer  | Unique alert identifier                                       |
| disabled                            | boolean  | Whether the alert is disabled                                 |
| alert_name                         | string   | Name of the alert                                            |
| email                              | string   | Email of the alert owner                                     |
| cc_emails                          | array    | List of CC email addresses for notifications                 |
| start_date                         | datetime | Alert start date (ISO 8601)                                 |
| end_date                           | datetime | Alert end date (ISO 8601)                                   |
| location_state                     | string   | State filter for sightings                                   |
| location_city                      | string   | City filter for sightings                                    |
| license_plate                      | string   | License plate to search                                      |
| license_plate_state                | string   | State of the license plate                                   |
| usdot_number                       | string   | USDOT number to search                                       |
| mc_number                          | string   | MC number to search                                          |
| chassis_number                     | string   | Chassis number to search                                     |
| container_number                   | string   | Container number to search                                   |
| exact_match_chassis_number         | boolean  | Require exact match for chassis number                       |
| exact_match_container_number       | boolean  | Require exact match for container number                     |
| vin                                | string   | VIN to search                                                |
| cab_number                         | string   | Cab number to search                                         |
| equipment_type                     | string   | Equipment type to search                                     |
| trailer_logo                       | string   | Trailer logo identifier                                      |
| trailer_number                     | string   | Trailer number to search                                     |
| alert_type                         | string   | Alert type: `hot` or `normal`                               |
| exact_match_trailer_number         | boolean  | Require exact match for trailer number                       |
| deep_search                        | string   | Deep search query                                            |
| exact_match_deep_search            | boolean  | Require exact match for deep search                          |
| notification_channels               | array    | Notification methods: `EMAIL`, `WEBHOOK`                    |
| create_date                        | datetime | Creation timestamp                                           |

## Error Responses

| Status | Description                                 |
|--------|---------------------------------------------|
| 401    | Unauthorized - Invalid or missing token     |
| 403    | Forbidden - Missing required permission      |
| 500    | Internal Server Error                        |
