---
title: "GET /api/v1/{context_id}/audit"
method: GET
path: "/api/v1/{context_id}/audit"
---

# GET /api/v1/{context_id}/audit

`GET /api/v1/{context_id}/audit`

Audit view over the trace graph. Returns recent traces with principal/key/time/kind filters.

## Path parameters

- `context_id` string, required

## Query parameters

- `principal` string
- `key` string
- `kind` 'decision' | 'retrieval' | 'response' — The trace `kind` discriminant — a closed three-value set over the trace tables. Serialises to `decision` / `retrieval` / `response` so the `/audit` wire shape and the `kind=` filter stay locked to the enum and can't drift (typos are rejected, the match arms are exhaustive, and the OpenAPI schema enumerates the allowed values).
- `since` string
- `until` string
- `limit` integer

## Response `200`

- AuditResponseJson
  - `rows` AuditRowJson[], required
    - `cost` number, double, required
    - `createdAt` string, required
    - `kind` 'decision' | 'retrieval' | 'response', required — The trace `kind` discriminant — a closed three-value set over the trace tables. Serialises to `decision` / `retrieval` / `response` so the `/audit` wire shape and the `kind=` filter stay locked to the enum and can't drift (typos are rejected, the match arms are exhaustive, and the OpenAPI schema enumerates the allowed values).
    - `latencyMs` integer, required
    - `model` string, nullable
    - `principal` string, nullable
    - `rowsTouched` integer, required
    - `traceId` string, required

## Other responses

- `400` — Invalid query parameter (e.g. unknown kind)
- `401` — Unauthorized
- `422` — Invalid context id

---

[API](https://skmtc.net/surrealdb/apis/spectron.md) · [All operations](https://skmtc.net/surrealdb/apis/spectron/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/surrealdb/spectron/versions/52b41ab517b6/schema)
