Audit Log

Query the immutable record of all approved changes.

List audit entries

Retrieve audit entries for a project. Every approved mutation is permanently recorded with before/after values.

GET /audit
Request
curl "http://localhost:8080/audit?project_id=my-project&limit=50"
Response
{
  "entries": [
    {
      "id": "aud_001",
      "session_id": "sess_abc123",
      "project_id": "my-project",
      "table_name": "users",
      "operation": "UPDATE",
      "row_id": "5",
      "old_data": {
        "id": 5,
        "name": "Alice",
        "role": "user"
      },
      "new_data": {
        "id": 5,
        "name": "Alice",
        "role": "admin"
      },
      "approved_at": "2024-01-15T10:40:00Z",
      "approved_by": "user@example.com"
    },
    {
      "id": "aud_002",
      "session_id": "sess_abc123",
      "project_id": "my-project",
      "table_name": "orders",
      "operation": "DELETE",
      "row_id": "10",
      "old_data": {
        "id": 10,
        "user_id": 5,
        "amount": 25.00,
        "status": "cancelled"
      },
      "new_data": null,
      "approved_at": "2024-01-15T10:40:00Z",
      "approved_by": "user@example.com"
    }
  ],
  "total_count": 2,
  "has_more": false
}

Query parameters

project_idstringFilter by project (required)
session_idstringFilter by session
table_namestringFilter by table
operationstringFilter by type (INSERT, UPDATE, DELETE)
sinceISO 8601Entries after this timestamp
untilISO 8601Entries before this timestamp
limitnumberMax entries to return (default: 100, max: 1000)
offsetnumberPagination offset

Get single entry

Retrieve a specific audit entry by ID.

GET /audit/:id

Immutability

Audit entries are append-only and cannot be modified or deleted. This ensures a complete forensic trail for compliance and debugging.

  • Every approved mutation creates an audit entry
  • Before/after values are captured at approval time
  • Session and user attribution is recorded
  • Timestamps use server time (UTC)