# Audit Logs

Who did what in Ella PSAP, and when. These paths require Admin.

## List Audit Logs

Returns the audit logs, newest first.

| Method | Path |
| --- | --- |
| GET | `/api/v1/logs/audit` |

### Query Parameters

| Name | Description |
| --- | --- |
| `page` | 1-based page number. Default: `1`. |
| `per_page` | Logs per page, 1 to 100. Default: `25`. |
| `user` | Only the logs of this user's email, ignoring case. |
| `action` | Only the logs of this action, such as `close_incident` or `auth_login`. |
| `start` | Only the logs at or after this time, in RFC 3339. |
| `end` | Only the logs before this time, in RFC 3339. |

### Response Fields

| Field | Type | Description |
| --- | --- | --- |
| `items[].id` | integer | ID of the log. |
| `items[].timestamp` | string | When it happened, in RFC 3339. |
| `items[].user` | string | Email of the user. Empty when unknown, such as for a rejected token. |
| `items[].action` | string | What was done, such as `close_incident`. |
| `items[].ip` | string | The address of the client. |
| `items[].details` | string | A description. It never holds the content of a text or a note. |
| `page` | integer | The page. |
| `per_page` | integer | Logs per page. |
| `total_count` | integer | Logs that match the filters. |

### Sample Response

```
{
    "result": {
        "items": [
            {
                "id": 1204,
                "timestamp": "2026-12-04T17:10:00.000Z",
                "user": "taker@example.com",
                "action": "close_incident",
                "ip": "10.90.3.21",
                "details": "Incident urn:emergency:uid:incidentid:01M8Y7CAN3N9GYZWWWAD7QMJSE:psap.example.org closed: handled"
            }
        ],
        "page": 1,
        "per_page": 25,
        "total_count": 1
    }
}
```

## List the Audit Log Filters

Returns the users and actions that appear in the audit logs, to filter them by.

| Method | Path |
| --- | --- |
| GET | `/api/v1/logs/audit/filters` |

### Response Fields

| Field | Type | Description |
| --- | --- | --- |
| `users` | array | The emails in the audit logs, deleted users included, at most 1000. |
| `actions` | array | The actions in the audit logs, at most 1000. |

## Get the Audit Log Retention

Returns how many days audit logs are kept.

| Method | Path |
| --- | --- |
| GET | `/api/v1/logs/audit/retention` |

### Response Fields

| Field | Type | Description |
| --- | --- | --- |
| `days` | integer | Audit logs older than this are deleted. |

## Update the Audit Log Retention

Sets how many days audit logs are kept.

| Method | Path |
| --- | --- |
| PUT | `/api/v1/logs/audit/retention` |

### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `days` | integer | Yes | 1 to 3650. Default: `31`. |
