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

# Audit

> Log and query tamper-evident audit entries

## Log

```go theme={null}
entry, err := client.Audit.Log(ctx, grantex.LogAuditParams{
    AgentID:     "ag_01HXYZ...",
    AgentDID:    "did:grantex:ag_01HXYZ...",
    GrantID:     "grnt_01HXYZ...",
    PrincipalID: "user_123",
    Action:      "email:read",
    Status:      "success",
    Metadata:    map[string]interface{}{"messageId": "msg-123"},
})
```

## List

```go theme={null}
result, err := client.Audit.List(ctx, &grantex.ListAuditParams{
    AgentID:     "agent-id",
    PrincipalID: "user-123",
    Action:      "email:read",
})
for _, e := range result.Entries {
    fmt.Printf("[%s] %s: %s\n", e.Timestamp, e.Action, e.Status)
}
```

Pass `nil` for no filters.

## Get

```go theme={null}
entry, err := client.Audit.Get(ctx, "entry-id")
```

## Types

### `AuditEntry`

| Field | Type | Description |
| - | - | - |
| `EntryID` | `string` | Entry ID |
| `AgentID` | `string` | Agent ID |
| `AgentDID` | `string` | Agent DID |
| `GrantID` | `string` | Grant ID |
| `PrincipalID` | `string` | User ID |
| `DeveloperID` | `string` | Owner developer ID |
| `Action` | `string` | Action performed |
| `Metadata` | `map[string]interface{}` | Custom metadata |
| `Hash` | `string` | Entry hash (chain integrity) |
| `PrevHash` | `*string` | Previous entry hash |
| `Timestamp` | `string` | ISO 8601 timestamp |
| `Status` | `string` | `"success"`, `"failure"`, `"blocked"` |

## Ownership

Grantex is owned by Orchestrum Technologies LLP. Inventor and owner: Sanjeev Kumar. Ownership contact: [sanjeev@orchestrum.in](mailto:sanjeev@orchestrum.in) or [mishra.sanjeev@gmail.com](mailto:mishra.sanjeev@gmail.com).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.