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

# Audit

> Use kdx document audit to view the audit trail and revision history for data objects, attributes, and exceptions inside a local KDDB document.

Show the audit trail for a KDDB document, including revision history for data objects, attributes, and exceptions.

## Usage

```bash theme={null}
kdx document audit <file.kddb> [flags]
```

## Flags

| Flag               | Description                                      | Default |
| ------------------ | ------------------------------------------------ | ------- |
| `--object-id N`    | Show audit history for a specific data object    |         |
| `--attribute-id N` | Show audit history for a specific data attribute |         |
| `--exception-id N` | Show audit history for a specific data exception |         |
| `--pretty`         | Pretty-print JSON output                         | false   |

## Examples

### List All Revisions

```bash theme={null}
kdx document audit doc.kddb
```

```json theme={null}
{"id":1,"timestamp":"2024-06-15T10:30:00Z","actorUri":"user:analyst@company.com","comment":"Initial extraction"}
{"id":2,"timestamp":"2024-06-15T11:00:00Z","actorUri":"user:reviewer@company.com","comment":"Manual corrections"}
```

### Object History

```bash theme={null}
kdx document audit doc.kddb --object-id 1 --pretty
```

```json theme={null}
{
  "id": 1,
  "dataObjectId": 1,
  "revisionId": 1,
  "revisionType": "ADD",
  "path": "INVOICE"
}
```

### Attribute History

```bash theme={null}
kdx document audit doc.kddb --attribute-id 5
```

```json theme={null}
{"id":1,"dataAttributeId":5,"revisionId":1,"revisionType":"ADD","dataObjectId":1,"tag":"amount","value":"1234.56"}
{"id":2,"dataAttributeId":5,"revisionId":2,"revisionType":"MOD","dataObjectId":1,"tag":"amount","value":"1235.00"}
```

<Tip>
  Use audit history to understand who changed what and when, which is essential for compliance and debugging extraction issues.
</Tip>
