---
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
- `cursor` string

## Response `200`

- AuditResponseJson
  - `page` PageMeta, required — The pagination block returned beside a page's rows.
    - `hasMore` boolean, required — Whether a further page exists.
    - `nextCursor` string, nullable — Token for the next page; absent on the last page.
    - `totalSize` integer, nullable — Total rows matching the filters, present only when the request asked for it with `count=true`.
  - `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
- `503` — Server too busy: the per-pod in-flight request cap was exceeded. Retry per the `Retry-After` header.

## Changes

- **2026-08-24** `9f1598713067` — 3 info
  - added the new optional `query` request parameter `cursor`
  - added the non-success response with the status `503`
  - added the required property `page` to the response with the `200` status

[Change history](https://skmtc.dev/surrealdb/apis/spectron/changes/api/v1/:context_id/audit/get.md)

---

[API](https://skmtc.dev/surrealdb/apis/spectron.md) · [All operations](https://skmtc.dev/surrealdb/apis/spectron/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/surrealdb/spectron/revisions/9f1598713067/schema)
