> For the complete documentation index, see [llms.txt](https://docs.umbraco.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.umbraco.com/ai-in-umbraco/management-api/audit-logs.md).

# Audit Logs

API endpoints for accessing AI operation audit logs.

The Audit Logs API provides access to operational audit records for AI operations. Every chat and embedding request is logged with details about the request, response, tokens used, and outcome.

## Endpoints

| Method | Endpoint                                                                                                                     | Description                     |
| ------ | ---------------------------------------------------------------------------------------------------------------------------- | ------------------------------- |
| GET    | [`/umbraco/ai/management/api/v1/audit-logs`](/ai-in-umbraco/management-api/audit-logs/list.md)                               | List audit logs with filtering  |
| GET    | [`/umbraco/ai/management/api/v1/audit-logs/{id}`](/ai-in-umbraco/management-api/audit-logs/get.md)                           | Get a specific audit log entry  |
| GET    | [`/umbraco/ai/management/api/v1/audit-logs?entityId={entityId}`](/ai-in-umbraco/management-api/audit-logs/entity-history.md) | Get audit history for an entity |
| DELETE | [`/umbraco/ai/management/api/v1/audit-logs/{id}`](/ai-in-umbraco/management-api/audit-logs/delete.md)                        | Delete a specific audit log     |
| POST   | [`/umbraco/ai/management/api/v1/audit-logs/cleanup`](/ai-in-umbraco/management-api/audit-logs/cleanup.md)                    | Clean up old audit logs         |

## Base URL

```
/umbraco/ai/management/api/v1
```

## Audit Log Object

{% code title="Audit Log" %}

```json
{
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "startTime": "2024-01-25T09:15:00Z",
    "endTime": "2024-01-25T09:15:02Z",
    "duration": "00:00:02.345",
    "status": "Succeeded",
    "errorCategory": null,
    "errorMessage": null,
    "userId": "user-guid",
    "userName": "admin@example.com",
    "entityId": "content-guid",
    "entityType": "document",
    "capability": "Chat",
    "profileId": "profile-guid",
    "profileAlias": "content-assistant",
    "profileVersion": 5,
    "providerId": "openai",
    "modelId": "gpt-4o",
    "featureType": "prompt",
    "featureId": "prompt-guid",
    "featureVersion": 2,
    "inputTokens": 150,
    "outputTokens": 420,
    "totalTokens": 570,
    "detailLevel": "Standard",
    "parentAuditLogId": null
}
```

{% endcode %}

## Status Values

| Status           | Description                      |
| ---------------- | -------------------------------- |
| `Running`        | Operation is in progress         |
| `Succeeded`      | Operation completed successfully |
| `Failed`         | Operation failed with an error   |
| `Cancelled`      | Operation was cancelled          |
| `PartialSuccess` | Operation partially completed    |

## Error Categories

| Category         | Description                  |
| ---------------- | ---------------------------- |
| `Authentication` | API key or credential issues |
| `RateLimit`      | Provider rate limit exceeded |
| `Timeout`        | Request timed out            |
| `InvalidRequest` | Malformed request            |
| `ModelError`     | Model processing error       |
| `NetworkError`   | Connection issues            |
| `Unknown`        | Unclassified error           |

## Detail Levels

Audit logs can be stored with different levels of detail:

| Level      | Includes                          |
| ---------- | --------------------------------- |
| `Minimal`  | Timing, status, tokens only       |
| `Standard` | Above + profile, model, user info |
| `Full`     | Above + prompt/response snapshots |

{% hint style="info" %}
Detail level is configured in application settings. Higher detail levels use more storage.
{% endhint %}

## Related

* [Audit Logs Backoffice](/ai-in-umbraco/backoffice/audit-logs.md)
* [Usage Analytics](/ai-in-umbraco/management-api/analytics.md)


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.umbraco.com/ai-in-umbraco/management-api/audit-logs.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
