> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ancestraldev.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Audit Log: Track All Administrative Changes in Avalex

> The Avalex audit log records every administrative action — who made the change, what changed, and when — so you have a complete, chronological history.

The Avalex audit log gives you a complete, chronological record of every administrative action taken in your instance. Whenever a staff member creates, updates, or deletes an entity — or performs a privileged action such as generating a registration key — Avalex writes an immutable entry capturing who did it, what changed, and exactly when it happened. This makes the audit log an essential tool for investigating unexpected changes, onboarding new admins, and demonstrating compliance with internal or regulatory requirements.

<Note>
  You need the **`actions:read`** permission to view the audit log in the portal or via the API.
</Note>

## Accessing the Audit Log in the Portal

Select **Audit Log** from the left-hand sidebar. The page loads the most recent administrative actions in reverse chronological order. Each row shows the event name, the staff member who performed the action, and the exact timestamp. Click any row to expand it and inspect the full `data` payload for that entry.

## What Gets Logged

Avalex records an audit entry for every mutation across all major entity types:

| Event Name                 | Description                                                |
| -------------------------- | ---------------------------------------------------------- |
| `customers.create`         | A new customer record was created                          |
| `customers.update`         | A customer record was modified                             |
| `customers.delete`         | A customer record was deleted                              |
| `products.create`          | A new product was created                                  |
| `products.update`          | A product was modified                                     |
| `products.delete`          | A product was deleted                                      |
| `licenses.create`          | A new license was issued                                   |
| `licenses.update`          | A license was modified (slots, expiration, bindings, etc.) |
| `licenses.delete`          | A license was deleted                                      |
| `orders.create`            | A new order was placed                                     |
| `orders.update`            | An order was modified                                      |
| `orders.delete`            | An order was deleted                                       |
| `staff.create`             | A new staff account was registered                         |
| `staff.setActive`          | A staff account was activated or deactivated               |
| `staff.delete`             | A staff account was permanently deleted                    |
| `staff.setRoles`           | The roles assigned to a staff account were changed         |
| `registrationKey.generate` | A new single-use registration key was generated            |

## Audit Log Entry Structure

Each entry in the audit log contains the following fields:

| Field                  | Description                                                                           |
| ---------------------- | ------------------------------------------------------------------------------------- |
| `id`                   | A unique identifier for this audit record.                                            |
| `name`                 | The event name, such as `customers.create` or `licenses.update`.                      |
| `performedBy`          | The username of the staff member who triggered the action.                            |
| `timestampEpochMillis` | The exact time the action occurred, as a Unix epoch timestamp in milliseconds.        |
| `data`                 | A JSON string containing a snapshot of the affected entity at the time of the action. |

### Example Entry

```json theme={null}
{
  "id": "act_999",
  "name": "customers.create",
  "performedBy": "ada",
  "timestampEpochMillis": 1723140500000,
  "data": "{\"id\":\"1\",\"name\":\"John Doe\"}"
}
```

## Accessing the Audit Log via API

You can retrieve audit log entries programmatically using the REST API:

```http theme={null}
GET /actions
```

The endpoint accepts an optional `limit` query parameter to control how many records are returned.

| Parameter | Default | Maximum | Description                                                              |
| --------- | ------- | ------- | ------------------------------------------------------------------------ |
| `limit`   | `200`   | `1000`  | The number of audit log entries to return, ordered by most recent first. |

**Example request:**

```http theme={null}
GET /actions?limit=500
```

Results are returned in reverse chronological order (most recent action first).

<Tip>
  Use the audit log to investigate unexpected changes — for example, if a license was modified or a customer was deleted and it is unclear who made the change. You can also export entries via the API to feed into an external compliance or SIEM system.
</Tip>
