# 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"
    },
    ...
  ]
}
```
