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

# Audit logs

### Audit logs <a href="#contact-logs" id="contact-logs"></a>

The Audit logs resource stores entries of every creation or update of content objects within DevHub. Each audit log includes the Timestamp, User ID that made the change, Object type, Object ID and details on the change (before/after).

### Audit log Model <a href="#contact-log-model" id="contact-log-model"></a>

An audit log object contains the following fields

| Attribute      | Type    | Description                                                                     |
| -------------- | ------- | ------------------------------------------------------------------------------- |
| `id`           | integer | unique id of the log                                                            |
| `action`       | string  | Action that was taken (`update`, `create`, `delete`)                            |
| `email`        | string  | Email associated with the User that made the change                             |
| `first_name`   | string  | First name associated with the User that made the change                        |
| `last_name`    | string  | Last name associated with the User that made the change                         |
| `timestamp`    | string  | Timestamp of the change                                                         |
| `object_class` | string  | Object type that was edited (example: `Site, Page)`                             |
| `object_pk`    | integer | Primary ID of the object that was edited                                        |
| `field_name`   | string  | Field on the object that was changed                                            |
| `old_value`    | string  | Summary of the previous value for the field. Note: Truncated for large payloads |
| `new_value`    | string  | Summary of the new value for the field. Note: Truncated for large payloads      |

**Example object**

```json
{
	"action": "update",
	"email": "demo@cloudbackend.net",
	"field_name": "custom_fields.custom_field_name",
	"first_name": "First",
	"id": 4628915,
	"last_name": "Name",
	"log_id": 979545,
	"new_value": "Changed value",
	"object_class": "Site",
	"object_pk": 4747764,
	"old_value": "Original value",
	"resource_uri": "/api/v2/audits/979545/",
	"timestamp": "2026-03-16T15:04:49"
}
```

### List audit logs <a href="#list-contact-logs" id="list-contact-logs"></a>

List all audit logs within the instance.

```
GET /api/v2/audits/
```

List all recent audit logs by ordering by ID descending.

```
GET /api/v2/audits/?order_by=-id
```

#### Response <a href="#response" id="response"></a>

```json
{
  "meta": {
    "limit": 20,
    "next": "/api/v2/audits/?order_by=-id",
    "offset": 0,
    "previous": null,
    "total_count": 5
  },
  "objects": [
    {
      "action": "update",
      "email": "demo@cloudbackend.net",
      "field_name": "custom_fields.custom_field_name",
      "first_name": "First",
      "id": 4628915,
      "last_name": "Name",
      "log_id": 979545,
      "new_value": "Changed value",
      "object_class": "Site",
      "object_pk": 4747764,
      "old_value": "Original value",
      "resource_uri": "/api/v2/audits/979545/",
      "timestamp": "2026-03-16T15:04:49"
    },
    ...
  ]
}
```


---

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://api-docs.devhub.com/logging-and-analytics/audit-logs.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
