# Evals API

## GET /api/v1/admin/evaluations/retention

`GET /api/v1/admin/evaluations/retention` · operation `evaluationResultRetention`

Evaluation result retention (T186.016). Requires evaluation_result_retention and config:read. Whether it runs (metadata_retention on with a window), the window in days and its source, the last pass (time, cutoff) and the totals removed, and what is always kept: human annotations, the results of a trace or request with an annotation or of a retained trace, datasets and their items, and runs still running.

**Authentication:** `adminSession`

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | The retention state. | `application/json`: object |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | Feature disabled | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `503` | storage_unavailable | — |

Response `200` fields:

- `application/json`: object
  - `enabled` (boolean, required)
  - `retain_days` (integer, required, min 0)
  - `retain_days_source` (string, required)
  - `state` (object, required)
    - `last_run_at` (string or null (date-time))
    - `last_cutoff` (string or null (date-time))
    - `deleted_results_total` (integer, min 0)
    - `deleted_runs_total` (integer, min 0)
  - `kept` (array of string, required)


## GET /api/v1/admin/route-experiments

`GET /api/v1/admin/route-experiments` · operation `listRouteExperiments`

Route experiments (T186.015, route_experiments, a tenant resource): the experiments of the teams the session reads (every team for a global administrator or viewer; an organization administrator also its organization's), newest first, with the limits and defaults. Requires route_experiments, canary_routing, evaluators, span_store, evals and route_experiments:read (404 feature_disabled without the flags).

**Authentication:** `adminSession`

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | The experiments | `application/json`: object |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | feature_disabled | — |
| `503` | storage_unavailable | — |

Response `200` fields:

- `application/json`: object
  - `data` (array of [RouteExperiment](/docs/api/schemas/r/#routeexperiment), required, max items 500)
  - `limits` (object, required)
  - `defaults` (object, required)


## POST /api/v1/admin/route-experiments

`POST /api/v1/admin/route-experiments` · operation `createRouteExperiment`

Start a route experiment on a canary alias for a team the session administers (route_experiments:manage), scored by an evaluator of that team (its own runs by evaluator ID; client, reviewer and guardrail scores never count; a trace with a failing run fails). guarded_rollback needs canary_auto_rollback and routing_versions on and the team in the alias's canary.auto_rollback.evaluation_teams (the operator's opt-in, team by team): with it, the watcher (every evaluation.monitors.tick) rolls the canary back through the canary auto-rollback when, with at least min_samples judged traces on each side and no cut read, the canary's pass rate is more than max_drop points below stable's; the experiment ends rolled_back once the routing version is stored, or stopped with rollback_not_written:&lt;state&gt;. Audited (route_experiment.create). At most 50 per team.

**Authentication:** `adminSession`

**Request body** (required)

- `application/json`: [RouteExperimentInput](/docs/api/schemas/r/#routeexperimentinput)

**Responses**

| Status | Description | Body |
|---|---|---|
| `201` | Created | `application/json`: [RouteExperiment](/docs/api/schemas/r/#routeexperiment) |
| `400` | invalid_request (no canary on the alias, another team's evaluator, a bound), rollback_unavailable, team_not_found | — |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Forbidden, or entitlement_forbidden: the team's plan lacks route_experiments | — |
| `404` | feature_disabled | — |
| `409` | limit_reached | — |
| `503` | storage_unavailable | — |


## GET /api/v1/admin/route-experiments/{id}

`GET /api/v1/admin/route-experiments/{id}` · operation `getRouteExperiment`

One experiment with its readout over its window (the last window_minutes, from its start, up to its end): per side (stable, canary) the team's traces of the alias, errors, pass and fail traces of the evaluator, pass rate (percent), cost and cost per trace (exact decimals; null when unknown), tokens per trace and p95 duration; the canary's pass_rate_lift (points) and cost_per_trace_lift (percent); decision collecting, holding, regressed or no_canary. truncated: an evaluation read hit 2,000 traces, the counts are lower bounds and no rollback is decided. Read from the span engine the trace explorer reads.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required, pattern `^rx_[a-f0-9]{24}$` |  |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | The experiment | `application/json`: [RouteExperiment](/docs/api/schemas/r/#routeexperiment) |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | not_found (also another team's experiment) or feature_disabled | — |
| `503` | storage_unavailable, analytics_store_unavailable or query_timeout | — |


## PUT /api/v1/admin/route-experiments/{id}

`PUT /api/v1/admin/route-experiments/{id}` · operation `updateRouteExperiment`

Change a running experiment's name, evaluator, min_samples, max_drop, window_minutes or guarded_rollback at expected_version; team and alias never change. Audited.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required, pattern `^rx_[a-f0-9]{24}$` |  |

**Request body** (required)

- `application/json`: [RouteExperimentInput](/docs/api/schemas/r/#routeexperimentinput)

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Updated | `application/json`: [RouteExperiment](/docs/api/schemas/r/#routeexperiment) |
| `400` | invalid_request, rollback_unavailable | — |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | not_found or feature_disabled | — |
| `409` | version_conflict or experiment_ended | — |
| `503` | storage_unavailable | — |


## DELETE /api/v1/admin/route-experiments/{id}

`DELETE /api/v1/admin/route-experiments/{id}` · operation `deleteRouteExperiment`

Delete an experiment, audited. A rollback it made stays: it is a routing version.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required, pattern `^rx_[a-f0-9]{24}$` |  |

**Responses**

| Status | Description | Body |
|---|---|---|
| `204` | Deleted | — |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | not_found or feature_disabled | — |
| `503` | storage_unavailable | — |


## POST /api/v1/admin/route-experiments/{id}/stop

`POST /api/v1/admin/route-experiments/{id}/stop` · operation `stopRouteExperiment`

End a running experiment as stopped, audited; its readout stays readable over the window it ran.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required, pattern `^rx_[a-f0-9]{24}$` |  |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Stopped | `application/json`: [RouteExperiment](/docs/api/schemas/r/#routeexperiment) |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | not_found or feature_disabled | — |
| `409` | experiment_ended | — |
| `503` | storage_unavailable | — |


## POST /api/v1/admin/evals/datasets/from-guardrail-cases

`POST /api/v1/admin/evals/datasets/from-guardrail-cases` · operation `createDatasetFromGuardrailCases`

Copy the gateway's labeled guardrail cases (GET /guardrails/datasets) into a new evaluation dataset of a team the session manages (T186.015, judge_guardrails; evals:manage): input is the case prompt, expected_output fail (the case must be stopped) or pass, metadata the case ID, framework, category and labels; frameworks narrows the cases. Use it to measure an evaluator with an experiment before it backs a judge guardrail.

**Authentication:** `adminSession`

**Request body** (required)

- `application/json`: object
  - `team_id` (string, required)
  - `name` (string, max length 120) — Default: Guardrail cases
  - `frameworks` (array of string)

**Responses**

| Status | Description | Body |
|---|---|---|
| `201` | The dataset | — |
| `400` | invalid_request or team_not_found | — |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | feature_disabled | — |
| `409` | duplicate | — |
| `503` | storage_unavailable | — |


## GET /api/v1/admin/evals/capture-policies

`GET /api/v1/admin/evals/capture-policies` · operation `listCapturePolicies`

Per-team capture policies. Requires eval_capture and evals:read. T186.005: with content_capture_evaluation this is a deprecated read-only view (Deprecation header, moved_to content_capture) of the content capture policies that carry the evaluation purpose, in the same shape (team_id, enabled, sample_rate, models, retention_days, updated_by, updated_at), within the caller's teams.

**Authentication:** `adminSession`

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | — |
| `400` | Invalid input | — |
| `404` | Feature disabled or not visible | — |


## PUT /api/v1/admin/evals/capture-policies/{team}

`PUT /api/v1/admin/evals/capture-policies/{team}` · operation `putCapturePolicy`

enabled, sample_rate (0,1], retention_days 1-90, optional models. Captures are taken after guardrail masking, encrypted with the control-plane key and deleted at expiry; evaluation traffic is never captured. Requires eval_capture and evals:manage. T186.005: with content_capture_evaluation the answer is 409 capture_policy_moved; set the evaluation purpose on the team's content capture policy instead.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `team` | path | string, required |  |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | — |
| `400` | Invalid input | — |
| `404` | Feature disabled or not visible | — |
| `409` | capture_policy_moved: content_capture_evaluation is on and the policy lives in content capture | — |


## GET /api/v1/admin/evals/captures

`GET /api/v1/admin/evals/captures` · operation `listCaptures`

Capture metadata only (request, team, model, expiry). Requires eval_capture and evals:read. T186.005: each entry has store, content_capture for a content capture record kept for evaluation (with its capture_id) or evaluation_capture for a capture written before content_capture_evaluation, kept until it expires; both are listed, newest first.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `team_id` | query | string | Only this team's rows. A team of the session, or for an organization administrator a team that left its organization (what it recorded there). A team the session may not name answers 403 team_forbidden. |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | — |
| `400` | Invalid input | — |
| `404` | Feature disabled or not visible | — |


## GET /api/v1/admin/evals/captures/{request}

`GET /api/v1/admin/evals/captures/{request}` · operation `getCapture`

Decrypted input messages and answer of one captured request; team administrators see only teams they administer. Requires eval_capture and evals:manage. T186.005: for a content capture record kept for evaluation the input is the sent view (after the input guardrails), as a list of messages, never the received view; the read is audited as content_capture.read with view:sent before anything is decrypted (503 when the audit row cannot be written) and answered with Cache-Control no-store; 409 capture_unreadable when the record was truncated at max_bytes or holds no sent view and text answer. A request captured in both stores is read from content capture. T186.005 extension, the content ladder: the read needs content_sent:read of the capture's team (403 content_read_forbidden otherwise); content gains level (sent or text), reasoning (the model's reasoning, only with content_reasoning:read) and media (the record's attachments, only with content_media:read); a reader without the media or reasoning permission gets the input with those parts replaced by {"type":"withheld","kind":...}; the audit target ends with view:&lt;what was shown&gt;, for example view:sent+reasoning+media. The same applies to a review queue item and a session transcript. A dataset built from captures keeps text and tool traffic only, whatever the importer reads: media becomes a text part "[media not imported]" and reasoning is left out.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `request` | path | string, required |  |
| `team` | query | string | The team whose capture to read. Each team keeps its own capture of a request ID (T192, migration 199); without team, the newest capture the session may read. |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | — |
| `400` | Invalid input | — |
| `404` | Feature disabled or not visible | — |
| `409` | capture_unreadable: truncated, or no sent view and text answer | — |


## GET /api/v1/admin/evals/queues

`GET /api/v1/admin/evals/queues` · operation `listAnnotationQueues`

Queues with description, assignees, pending and completed counts, and can_annotate for the reader (an open queue is worked by the people who administer its team; an assigned queue by its assignees, whatever their role, and by whoever assigns across the gateway). With review_multi_annotator each queue also carries scope (any, trace, span or session), instructions, annotators_per_item, lock_timeout_seconds, comments_enabled, required_names, disagreements (items whose reviewers differ), unresolved (those with a field still tied) and automations (active automations that fill it). Requires evals and evals:read.

**Authentication:** `adminSession`

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | — |
| `400` | Invalid input | — |
| `404` | Feature disabled or not visible | — |


## POST /api/v1/admin/evals/queues

`POST /api/v1/admin/evals/queues` · operation `createAnnotationQueue`

team_id, name, optional description (up to 1000 characters), 1-10 score config names (the form fields) and up to 50 assignees: active console users who hold reviews:annotate and belong to the team (who administer it, without review_multi_annotator). With review_multi_annotator also: scope (any by default; trace, span or session limits what the queue holds), instructions (up to 4000 characters, shown to the reviewer before the first item), annotators_per_item (1-10; default review.annotators_per_item), lock_timeout_seconds (60-86400; default review.lock_timeout_seconds), comments_enabled (true by default) and required_names (fields of the form a review cannot leave empty). A setting of review v2 sent while the flag is off for the team is refused 404 feature_disabled. Requires evals and review_queues:manage.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object

**Responses**

| Status | Description | Body |
|---|---|---|
| `201` | Created | — |
| `400` | Invalid input | — |
| `404` | Feature disabled or not visible | — |


## PUT /api/v1/admin/evals/queues/{id}

`PUT /api/v1/admin/evals/queues/{id}` · operation `updateAnnotationQueue`

Replaces name, description, score_names and assignees with the create rules; scope, instructions, annotators_per_item, lock_timeout_seconds, comments_enabled and required_names keep their value when omitted. annotators_per_item applies to the items added afterwards. The team cannot change. Requires evals and review_queues:manage.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | — |
| `400` | Invalid input | — |
| `404` | Feature disabled or not visible | — |


## DELETE /api/v1/admin/evals/queues/{id}

`DELETE /api/v1/admin/evals/queues/{id}` · operation `deleteAnnotationQueue`

Hides the queue. Scores it produced belong to their targets and stay. Requires evals and review_queues:manage.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Responses**

| Status | Description | Body |
|---|---|---|
| `204` | Deleted | — |
| `404` | Feature disabled or not visible | — |


## GET /api/v1/admin/evals/queues/{id}/items

`GET /api/v1/admin/evals/queues/{id}/items` · operation `listAnnotationQueueItems`

Items oldest first, with the current lock and who completed each one. Each item also carries annotators_required, source (manual or automation, with automation_id), assignees (the item own reviewers; empty: the queue reviewers), reviews (one per reviewer: reviewer, status in_progress, completed or skipped, locked_until, started_at, completed_at), disagreement, unresolved and former_organization (the target was recorded before the team moved to its current organization: listed without answers or finals, never reviewed). Every reviewer answers (reviews[].answers) and the finals (per field: state agreed, majority, mean, tie, resolved or listed, value, disagreement, annotators, decided_by, score_id) are shown to readers with reviews:calibrate or review_queues:manage over the team; anyone else sees who reviewed and their own answers. Requires evals and evals:read.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |
| `status` | query | string, one of `"pending"`, `"completed"` | Only pending or only completed items. |
| `limit` | query | integer, min 1, max 500 | Most items listed, 1-500. |
| `disagreement` | query | boolean | true keeps the items whose reviewers differ on a field. |
| `mine` | query | boolean | true keeps the pending items the caller has not reviewed or skipped. |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | — |
| `400` | Invalid input | — |
| `404` | Feature disabled or not visible | — |


## POST /api/v1/admin/evals/queues/{id}/items

`POST /api/v1/admin/evals/queues/{id}/items` · operation `addAnnotationQueueItems`

1-500 targets: request (with a capture of the team), session (a session ID with requests of the team; the reviewer sees its summary and up to 20 captured turns), run_item (&lt;run&gt;/&lt;item&gt;) and, with review_multi_annotator and evaluation_results, trace (a 32-hex trace ID of the team) or span (&lt;trace_id&gt;/&lt;span_id&gt;). A queue whose scope is trace, span or session takes only that kind (a request also enters a trace or a span queue). Each item asks for the queue annotators_per_item reviews. Missing or foreign targets are refused. Requires evals and review_queues:manage.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | — |
| `400` | Invalid input | — |
| `404` | Feature disabled or not visible | — |


## DELETE /api/v1/admin/evals/queues/{id}/items

`DELETE /api/v1/admin/evals/queues/{id}/items` · operation `removeAnnotationQueueItem`

Removes a pending item nobody finished reviewing. A completed item, and a pending one that holds a finished review, record their annotation and stay (409 item_completed). Requires evals and review_queues:manage.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |
| `target_type` | query | string, required, one of `"request"`, `"session"`, `"run_item"`, `"trace"`, `"span"`, `"prompt"` | Kind of the item to remove: request, session, run_item, trace or span. |
| `target_id` | query | string, required | ID of the item to remove, of that kind. |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Responses**

| Status | Description | Body |
|---|---|---|
| `204` | Removed | — |
| `400` | Invalid input | — |
| `404` | Feature disabled or not visible | — |
| `409` | Item already completed | — |


## POST /api/v1/admin/evals/queues/{id}/next

`POST /api/v1/admin/evals/queues/{id}/next` · operation `nextAnnotationItem`

Gives the reviewer the item they already hold, else the oldest pending item that still has a seat for them (one they have not reviewed or skipped, assigned to them or to nobody, and with fewer reviewers at work or done than it asks for), locked for the queue lock_timeout_seconds (ten minutes by default), and returns its content and fields; item null when nothing is left for them. With review_multi_annotator the answer also holds draft (the answers they saved), progress (reviewed, skipped, remaining) and trace (trace_id and, for a span, span_id: what the trace view opens). Captured content follows the reviewer content permissions: without content_sent:read the content says so instead of the text. 403 not_assigned when the queue is assigned to other people. Requires evals and reviews:annotate.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | — |
| `400` | Invalid input | — |
| `404` | Feature disabled or not visible | — |


## POST /api/v1/admin/evals/queues/{id}/complete

`POST /api/v1/admin/evals/queues/{id}/complete` · operation `completeAnnotationItem`

Stores every score of the form (all validated first, all or nothing) as human results of the item target, written by the reviewer, and finishes their review: target_type, target_id and scores (name, value or string_value, optional comment). The item is completed once as many reviews are finished as it asks for; the answer says item_status and, when it completes, disagreement and unresolved. A field of required_names left out is refused 400 required_field; a second review by the same person 409 invalid_state; an item whose reviews are all taken 409 item_locked. When several people reviewed the item, each result carries metadata.review.role annotator and the final value of a field (unanimous, a strict majority, or the mean of numbers) is written as one more human result with role final; a tie has no final value until someone settles it. Requires evals and reviews:annotate.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | — |
| `400` | Invalid input | — |
| `404` | Feature disabled or not visible | — |


## POST /api/v1/admin/evals/queues/{id}/open

`POST /api/v1/admin/evals/queues/{id}/open` · operation `openAnnotationItem`

Gives the reviewer a seat on a named pending item (target_type, target_id) and returns what next returns for it. 409 item_locked when every review of the item is held or done by other people, 409 invalid_state when the item is completed or the caller already reviewed it, 403 not_assigned when the item or the queue is assigned to other people (reviews:assign over the team takes any item). Requires evals and reviews:annotate.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | — |
| `400` | Invalid input | — |
| `403` | Assigned to other people | — |
| `404` | Feature disabled or not visible | — |
| `409` | Item locked or already reviewed | — |


## POST /api/v1/admin/evals/queues/{id}/skip

`POST /api/v1/admin/evals/queues/{id}/skip` · operation `skipAnnotationItem`

The reviewer passes on a pending item (target_type, target_id): their seat is free again, the queue does not offer them the item a second time and they cannot open it later (409 invalid_state). Requires evals, review_multi_annotator and reviews:annotate.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object

**Responses**

| Status | Description | Body |
|---|---|---|
| `204` | Skipped | — |
| `400` | Invalid input | — |
| `404` | Feature disabled or not visible | — |
| `409` | Already reviewed | — |


## POST /api/v1/admin/evals/queues/{id}/draft

`POST /api/v1/admin/evals/queues/{id}/draft` · operation `saveAnnotationDraft`

Keeps what the reviewer filled in so far on the item they hold (target_type, target_id, answers: name with value or string_value and an optional comment, each up to 2000 characters) and renews their lock. Nothing is written as a result until complete. 409 lock_expired when their lock ended. Requires evals, review_multi_annotator and reviews:annotate.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object

**Responses**

| Status | Description | Body |
|---|---|---|
| `204` | Saved | — |
| `400` | Invalid input | — |
| `404` | Feature disabled or not visible | — |
| `409` | Lock expired | — |


## POST /api/v1/admin/evals/queues/{id}/assign

`POST /api/v1/admin/evals/queues/{id}/assign` · operation `assignAnnotationItems`

Names who reviews 1-500 pending items: targets (type, id) and up to 50 assignees, active console users who hold reviews:annotate and belong to the team. Each assignee must be one of the queue reviewers (someone who may work it), and there must be at least as many as the queue annotators_per_item; an empty assignees list gives the items back to the queue reviewers. The answer says how many items changed hands. Requires evals, review_multi_annotator and reviews:assign.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | — |
| `400` | Invalid input | — |
| `404` | Feature disabled or not visible | — |


## POST /api/v1/admin/evals/queues/{id}/final

`POST /api/v1/admin/evals/queues/{id}/final` · operation `settleAnnotationFinal`

Settles the final value of one field of a completed item that several people answered: target_type, target_id, name and value or string_value (validated as a score of that name), optional comment. The value is written as a human result of the target with metadata.review.role final and the field becomes resolved, keeping that its reviewers differed; the other fields are untouched. 409 nothing_to_settle on a field one person answered or on text. Requires evals, review_multi_annotator, reviews:calibrate and administration of the queue team (the read-only role reads the calibration and settles nothing).

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | — |
| `400` | Invalid input | — |
| `404` | Feature disabled or not visible | — |
| `409` | Item not completed, or nothing to settle | — |


## GET /api/v1/admin/evals/queues/{id}/export

`GET /api/v1/admin/evals/queues/{id}/export` · operation `exportAnnotationQueue`

Downloads up to 500 items of the queue with every reviewer values and comments and the final value of each field. CSV columns: queue_id, target_type, target_id, item_status, source, row (review or final), reviewer, review_status, completed_at, field, value, comment, final_state, disagreement. Requires evals, review_multi_annotator and reviews:calibrate.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |
| `format` | query | string, one of `"json"`, `"csv"`, default `"json"` | json (the queue and its items with reviews and finals) or csv (one row per reviewer answer and one per final value). |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | — |
| `400` | Invalid input | — |
| `404` | Feature disabled or not visible | — |


## GET /api/v1/admin/evals/review/my-items

`GET /api/v1/admin/evals/review/my-items` · operation `listMyReviewItems`

What the queues of the caller teams still hold for them by name: per queue, pending (items assigned to them, on the item or through the queue assignees, that they have not reviewed or skipped), assigned (those assigned on the item itself) and the first 10 items; pending is the total. Requires evals and evals:read.

**Authentication:** `adminSession`

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | — |
| `404` | Feature disabled or not visible | — |


## GET /api/v1/admin/evals/review/settings

`GET /api/v1/admin/evals/review/settings` · operation `getReviewSettings`

The effective review block of the gateway YAML, read at startup: annotators_per_item, lock_timeout_seconds and automations (interval_seconds, lookback_seconds, sample_rate, max_items, daily_cap, per_team, max_matches_per_sweep), each with value, min, max and default, plus the state of the review_multi_annotator and review_automations flags. Requires evals and evals:read.

**Authentication:** `adminSession`

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | `application/json`: object |
| `404` | Feature disabled or not visible | — |

Response `200` fields:

- `application/json`: object
  - `features` (object, required) — review_multi_annotator and review_automations as the gateway runs them.
    - any other key: boolean
  - `source` (string, required, one of `"yaml"`)
  - `apply` (string, required, one of `"restart"`)
  - `review` ([ReviewSettings](/docs/api/schemas/r/#reviewsettings), required)


## GET /api/v1/admin/evals/calibration

`GET /api/v1/admin/evals/calibration` · operation `reviewCalibration`

How each judge agrees with the reviewers on one label. Per judge with results: the figures of GET /evals/agreement for the pairs (pairs, pearson, spearman, mae, rmse, heatmap, accuracy, kappa, macro_f1, confusion), equal to that endpoint on the same data, plus unmatched_human and unmatched_judge (results of one side with no partner), truncated (10000 pairs read) and up to 50 disagreements (target, trace_id, human, judge, reviewer). A label and a judge may share a name: the human side is what people wrote, the judge side what judges produced. reviewers gives the same figures between people who reviewed the same item, with items and unanimous. The answer names the period read (from, to). Requires evals, review_multi_annotator and reviews:calibrate over the team.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `team_id` | query | string, required | A team the caller administers. |
| `label` | query | string, max length 80 | The human label to calibrate against. Omitted: the answer lists the team labels and judges. |
| `judge` | query | string, max length 80 | One judge (a score name). Omitted: every evaluator of the team, up to 50. |
| `pair_by` | query | string, one of `"target"`, `"trace"`, default `"target"` | target pairs results of the same target, as the agreement endpoint does; trace pairs results on the same trace whatever their scope. |
| `basis` | query | string, one of `"final"`, `"annotators"`, default `"final"` | On items several people reviewed: the item final value (default) or every reviewer own value. |
| `from` | query | string (date-time) | Start of the period (RFC 3339). Default: 30 days before to. |
| `to` | query | string (date-time) | End of the period (RFC 3339). Default: now. The period is at most 400 days; one holding more than 100000 results of the label or of a judge answers 400 (choose a shorter period). |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | — |
| `400` | Invalid input | — |
| `404` | Feature disabled or not visible | — |


## GET /api/v1/admin/automations

`GET /api/v1/admin/automations` · operation `listAutomations`

Automations of the caller teams, newest first: id, team_id, name, description, scope (traces or spans), query, destination (queue or dataset) and destination_id, sample_rate, max_items, daily_cap, status (active or paused) with paused_reason (cap_reached, paused_by_user, destination_missing, destination_scope_changed, evaluation_results_off, query_invalid, sweep_failing, owner_inactive, owner_cannot_read_content), added, added_today, matched, active_from, cursor_at, last_run_at, last_error, failures (sweeps failed in a row; 20 pause it) and owner. Requires evals, review_automations and evals:read.

**Authentication:** `adminSession`

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | — |
| `404` | Feature disabled or not visible | — |


## POST /api/v1/admin/automations

`POST /api/v1/admin/automations` · operation `createAutomation`

Creates an automation that fills a review queue or a dataset of the team from live traffic: team_id, name (1-80), optional description, scope (traces by default, or spans), query (the query language over that scope, up to 2000 characters; no text search, an automation has no reader), destination (queue or dataset) and destination_id, sample_rate (above 0 to 1), max_items (1-100000; it pauses there with cap_reached) and daily_cap (0-100000 per UTC day, 0 none), each defaulting to the review.automations block, and status (active by default). It adds only what is recorded after it was created, changed or resumed. A trace queue takes a traces automation, a span queue a spans one, a session queue the session of each match. A dataset automation copies the captured sent view and answer of each matched request as its owner (the caller), who must be a named user with content_sent:read of the team (403 content_read_forbidden). 409 automation_capacity past review.automations.per_team. Requires evals, review_automations (and review_multi_annotator for a queue) and review_queues:manage.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object

**Responses**

| Status | Description | Body |
|---|---|---|
| `201` | Created | — |
| `400` | Invalid input | — |
| `403` | Owner cannot read the team content | — |
| `404` | Feature disabled or not visible | — |
| `409` | Team capacity reached | — |


## GET /api/v1/admin/automations/{id}

`GET /api/v1/admin/automations/{id}` · operation `getAutomation`

One automation of the caller teams. Requires evals, review_automations and evals:read.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | — |
| `404` | Feature disabled or not visible | — |


## PUT /api/v1/admin/automations/{id}

`PUT /api/v1/admin/automations/{id}` · operation `updateAutomation`

Replaces name, description and query; scope, destination with destination_id, sample_rate, max_items, daily_cap and status keep their value when omitted. The caller becomes the owner. A changed query, scope or destination, and a return to active, make it look forward from now. The team cannot change. Requires evals, review_automations and review_queues:manage.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | — |
| `400` | Invalid input | — |
| `403` | Owner cannot read the team content | — |
| `404` | Feature disabled or not visible | — |


## DELETE /api/v1/admin/automations/{id}

`DELETE /api/v1/admin/automations/{id}` · operation `deleteAutomation`

Hides the automation; what it added stays where it is. Requires evals and review_queues:manage.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Responses**

| Status | Description | Body |
|---|---|---|
| `204` | Deleted | — |
| `404` | Feature disabled or not visible | — |


## POST /api/v1/admin/automations/{id}/pause

`POST /api/v1/admin/automations/{id}/pause` · operation `pauseAutomation`

Pauses the automation (paused_reason paused_by_user); its owner stays. Requires evals, review_automations and review_queues:manage.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | — |
| `404` | Feature disabled or not visible | — |


## POST /api/v1/admin/automations/{id}/resume

`POST /api/v1/admin/automations/{id}/resume` · operation `resumeAutomation`

Makes the automation active again, looking forward from now; the caller becomes the owner. 409 cap_reached while it has added its max_items: raise the cap first. Requires evals, review_automations and review_queues:manage.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | — |
| `400` | Invalid input | — |
| `403` | Owner cannot read the team content | — |
| `404` | Feature disabled or not visible | — |
| `409` | Cap reached | — |


## GET /api/v1/admin/evals/agreement

`GET /api/v1/admin/evals/agreement` · operation `scoreAgreement`

team_id, a and b: two score names on the same targets. team_id is a team of the session or, for an organization administrator, a team that left its organization (the scores it recorded there); any other team answers 404. Numeric: Pearson, Spearman, mean absolute error and RMSE. Labels: accuracy, Cohen kappa, macro F1 (a is the reference) and confusion matrix. Requires evals and evals:read. With numeric pairs it also returns heatmap: a_bins and b_bins (up to 10 equal-width ranges, each axis over its own values; one when all equal) and counts[row][column] with score A by row (a 10x10 heatmap).

**Authentication:** `adminSession`

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | — |
| `400` | Invalid input | — |
| `404` | Feature disabled or not visible | — |


## GET /api/v1/admin/evals/compare

`GET /api/v1/admin/evals/compare` · operation `compareEvalExperiments`

Runs side by side against a baseline: per run, item counts, latency (average, p50, p95), input and output tokens, score aggregates, improved/regressed/unchanged/changed counts per score and avg_delta (T186.018: per score with an average in both runs, this run's average minus the baseline's, over all items; absent on the baseline); per item, every run's output, scores, delta, request_id (links the request journey), input_tokens and output_tokens. With usage_valuation on and analytics:read, each run and each item cell carry cost, the run detail's ledger cost (state known|partial|unknown, known_usd exact decimal string, requests, unvalued_requests; absent when no request of it is in the ledger). total_items counts the items after filter and the score filter; score_filter echoes the score filter {score, op, value, run} and is absent without one. Higher numeric scores are better. Items are filtered (regressed: a lower score or a new failure; changed: any difference) before paging. same_items is false when the runs read different versions of an item. charts (ADR 0150) covers every item of every run, not the page: per score name, bins shared by all runs (ten equal numeric bins between the smallest and largest value, or one bin for one value; false and true for boolean; labels for categorical), each with an item count per run ID; latency bins cover completed items. Requires evals and evals:read; team roles are limited to their teams.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `runs` | query | string, required | 2-5 run IDs of one dataset, separated by commas |
| `baseline` | query | string | One of the runs; defaults to the first |
| `filter` | query | string, one of `"all"`, `"regressed"`, `"changed"`, default `"all"` | Which items to page through: all (default), regressed (a lower score or a new failure) or changed (any difference). |
| `score` | query | string, max length 80 | A score name: keeps the items whose score of this name passes score_op and score_value, in score_run or in any compared run. Combines with filter; applied before paging. |
| `score_op` | query | string, one of `"eq"`, `"ne"`, `"gt"`, `"gte"`, `"lt"`, `"lte"`, default `"eq"` | Comparison with score_value. Numeric and boolean scores take every operator; categorical and text scores only eq and ne. gt, gte, lt and lte need a number or true/false in score_value. An item without the score in a run never matches there, ne included. Needs score. |
| `score_value` | query | string, max length 200 | The value to compare with; true and false read as 1 and 0. Required with score. |
| `score_run` | query | string | Apply the score filter to this run only; one of runs. Any compared run by default. Needs score. |
| `limit` | query | integer, default `100`, min 1, max 500 | Most items on this page, 1-500 (100 by default). |
| `offset` | query | integer, default `0`, min 0 | Items to skip before this page. |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | — |
| `400` | Invalid input | — |
| `404` | Feature disabled or not visible | — |


## GET /api/v1/admin/evals/score-analytics

`GET /api/v1/admin/evals/score-analytics` · operation `evalScoreAnalytics`

Statistics of one score of a team over a period, from one database snapshot: count, mean, standard deviation, minimum and maximum; an exact 10-bin histogram for numeric scores, true/false counts for boolean, label counts and mode for categorical; counts by source; and a zero-filled trend of count and average. Requires evals and evals:read; team roles are limited to their teams.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `team_id` | query | string, required | The team whose scores are summarized: its scores of its current organization. An organization administrator may name a team that left its organization, and reads the scores it recorded there. A team the session may not name answers 404. |
| `name` | query | string, required |  |
| `data_type` | query | string, one of `"numeric"`, `"boolean"`, `"categorical"`, `"text"` | Required when the name has values of several data types |
| `target_type` | query | string, one of `"request"`, `"session"`, `"run_item"`, `"run"` | Only scores of this kind of target: request, session, run_item or run. |
| `source` | query | string, one of `"api"`, `"eval"`, `"annotation"` | Only scores from the API, an evaluation judge or a human annotation. |
| `from` | query | string (date-time) | RFC 3339, with to; default the last 30 days by the database clock |
| `to` | query | string (date-time) | End of the period, RFC 3339. |
| `interval` | query | string, one of `"hour"`, `"day"`, `"week"` | Trend bucket; chosen from the period when omitted, at most 500 buckets |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | — |
| `400` | Invalid input or several data types | — |
| `404` | Feature disabled or not visible | — |


## GET /api/v1/admin/evals/evaluator-templates

`GET /api/v1/admin/evals/evaluator-templates` · operation `listEvalEvaluatorTemplates`

Ready LLM-as-judge rubrics (correctness, faithfulness, helpfulness, relevance, conciseness, safety, tone, language match) with prompt, output and the variables they read. A template is copied into a team evaluator; it is never run directly. With code_evaluators (T186.009) the answer is the whole library and its categories: judges, decision models (output.question and output.options), code (code) and rules (rule), each with category, kind (llm_judge, decision, code, rule), scope, example_output, placeholders (a &lt;&lt;FILL: ...&gt;&gt; text that must be replaced before publishing), recommended and fixtures (the documented cases it is tested against: input, output, expected or data, and the value, label, assessment or status they give). Requires evals and evals:read.

**Authentication:** `adminSession`

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | — |
| `404` | Feature disabled or not visible | — |


## GET /api/v1/admin/evals/score-configs

`GET /api/v1/admin/evals/score-configs` · operation `listEvalScoreConfigs`

Typed score definitions shared by people and judges. Requires evals and evals:read; team roles are limited to their teams.

**Authentication:** `adminSession`

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | — |
| `400` | Invalid input | — |
| `404` | Feature disabled or not visible | — |


## POST /api/v1/admin/evals/score-configs

`POST /api/v1/admin/evals/score-configs` · operation `createEvalScoreConfig`

numeric (min/max), boolean, categorical (2-20 categories) or text; the type never changes. A categorical config may give each category a number in category_values (same order and length), as categorical values: a score with that label is recorded with that value too, so means and agreement apply. Requires evals and evals:manage; team roles are limited to their teams.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object

**Responses**

| Status | Description | Body |
|---|---|---|
| `201` | Created | — |
| `400` | Invalid input | — |
| `404` | Feature disabled or not visible | — |


## DELETE /api/v1/admin/evals/score-configs/{id}

`DELETE /api/v1/admin/evals/score-configs/{id}` · operation `archiveEvalScoreConfig`

Archives a score config. Requires evals and evals:manage; team roles are limited to their teams.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Responses**

| Status | Description | Body |
|---|---|---|
| `204` | Archived | — |
| `400` | Invalid input | — |
| `404` | Feature disabled or not visible | — |


## PATCH /api/v1/admin/evals/score-configs/{id}

`PATCH /api/v1/admin/evals/score-configs/{id}` · operation `updateEvalScoreConfig`

Changes the description (up to 1000 characters; empty clears it) or brings an archived config back with archived false. Name, type and range never change, since recorded scores were checked against them; other fields are refused. Requires evals and evals:manage; team roles are limited to their teams.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object
  - `description` (string, max length 1000)
  - `archived` (boolean)

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | The updated config | — |
| `400` | Nothing to change, unknown field or description too long | — |
| `404` | Feature disabled or not visible | — |


## GET /api/v1/admin/evals/scores

`GET /api/v1/admin/evals/scores` · operation `listEvalScores`

With evaluation_results on this list is a deprecated alias of /api/v1/admin/evaluations (same rows; Deprecation: true and a successor-version Link header) and source filters match the old and new names (eval matches llm and code, annotation matches human). Scores newest first (created_at, then id), a page at a time. total counts every score matching the filters among the teams the reader may see: the team filter applies before the count and the page. has_more says a later page has rows. Requires evals and evals:read; team roles are limited to their teams.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `team_id` | query | string | Only this team's rows. A team of the session, or for an organization administrator a team that left its organization (what it recorded there). A team the session may not name answers 403 team_forbidden. |
| `name` | query | string | Only scores of this exact name. |
| `target_type` | query | string, one of `"request"`, `"session"`, `"run_item"`, `"run"` | Only scores of this kind of target. |
| `target_id` | query | string | Only scores of this target (a request ID, session ID, run_id/item_id or run ID). |
| `run_id` | query | string | Only scores of this experiment run. |
| `source` | query | string, one of `"api"`, `"eval"`, `"annotation"` | Only scores from the API, an evaluation judge or a human annotation. |
| `limit` | query | integer, default `100`, min 1, max 500 | Most scores on this page, 1-500; any other value reads 100, as before paging. |
| `offset` | query | integer, default `0`, min 0, max 100000 | Scores to skip before this page (T186.018); a negative, non-numeric or larger than 100000 offset is 400 invalid_request. Narrow the filters to reach older scores. |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | One page of scores | `application/json`: object |
| `400` | Invalid input | — |
| `404` | Feature disabled or not visible | — |

Response `200` fields:

- `application/json`: object
  - `data` (array of object, required) — Scores. redacted_reason (judged_another_team_capture) marks a judge score whose comment migration 199 replaced with a fixed marker because the judge had read another team's capture; the value is kept.
  - `total` (integer, required, min 0) — Scores matching the filters in the reader's teams.
  - `offset` (integer, required, min 0)
  - `limit` (integer, required, min 1, max 500)
  - `has_more` (boolean, required) — offset plus the rows on this page is less than total.


## POST /api/v1/admin/evals/scores

`POST /api/v1/admin/evals/scores` · operation `createEvalScore`

Annotation by a console user; same validation as POST /v1/scores, plus team_id. Requires evals and evals:manage; team roles are limited to their teams. data_type correction (ADR 0153) is the corrected output of a reviewer: name "output", string_value up to 32000 characters, one per target (a new one replaces the last); from-captures uses it as the expected output.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object

**Responses**

| Status | Description | Body |
|---|---|---|
| `201` | Created | — |
| `400` | Invalid input | — |
| `404` | Feature disabled or not visible | — |


## DELETE /api/v1/admin/evals/scores/{id}

`DELETE /api/v1/admin/evals/scores/{id}` · operation `deleteEvalScore`

Deletes a score. Requires evals and evals:manage; team roles are limited to their teams.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Responses**

| Status | Description | Body |
|---|---|---|
| `204` | Deleted | — |
| `400` | Invalid input | — |
| `404` | Feature disabled or not visible | — |


## GET /api/v1/admin/evaluations

`GET /api/v1/admin/evaluations` · operation `listEvaluations`

Evaluation results (T186.003), newest first (created_at, then id), a cursor page at a time, from every engine that holds them (spans.engine), each result once. The session's teams (narrowed to plan-entitled teams under feature_plan_entitlements) filter the rows first. Requires evals, evaluation_results and evals:read. The judge's reasoning is shown only to a reader with content_sent:read of the result's team (the content ladder: by role, or by a content:read grant); reasoning_state reader_grant_required means the session lacks it; showing explanations is audited (evaluation.reasoning.read, one row per team and answer) before any is decrypted. A value outside the set of scope, source, assessment, status or metric_type answers 400 invalid_request with the set (T186.007).

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `scope` | query | string, one of `"span"`, `"trace"`, `"session"`, `"run_item"`, `"run"` |  |
| `trace_id` | query | string |  |
| `span_id` | query | string |  |
| `request_id` | query | string | Up to 200 request IDs, comma-separated. |
| `session_id` | query | string | Results on the session and on its requests. |
| `end_user` | query | string, min length 1, max length 128 | T186.011: the results of an end user's requests, and (T186.011b) the results recorded on the sessions the end user owns (the session's first-written end user, as its row shows; at most 2,000 sessions). Needs end_user_pages and end_user_tracking (400 otherwise). |
| `name` | query | string |  |
| `source` | query | string, one of `"llm"`, `"code"`, `"human"`, `"api"`, `"feedback"`, `"eval"`, `"annotation"` | Old and new names of a source match both. |
| `assessment` | query | string, one of `"pass"`, `"fail"`, `"none"` |  |
| `status` | query | string, one of `"ok"`, `"error"`, `"skipped"`, `"pending"` |  |
| `evaluator_id` | query | string |  |
| `judge_trace_id` | query | string, pattern `^[0-9a-f]{32}(,[0-9a-f]{32}){0,199}$` | T186.004: the results the judge runs of these traces produced, by the judges' own trace IDs, comma-separated, at most 200. Requires evaluation_tracing (400 otherwise). |
| `metric_type` | query | string, one of `"boolean"`, `"score"`, `"categorical"`, `"json"`, `"text"` |  |
| `join_key` | query | string |  |
| `run_id` | query | string |  |
| `ids` | query | string | Up to 200 result IDs, comma-separated. |
| `team_id` | query | string | One of the session's teams; another answers 403 team_forbidden. |
| `lens` | query | string, one of `"feedback"` |  |
| `mine` | query | boolean, default `false` | Only the results this console session recorded (its thumbs on session turns, its reviews). |
| `include_invalid` | query | boolean, default `false` | Also withdrawn results (valid false). |
| `limit` | query | integer, default `50`, min 1, max 200 |  |
| `cursor` | query | string | next_cursor of the previous page; opaque. |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | One page of results | `application/json`: object |
| `400` | Invalid input | — |
| `403` | team_forbidden | — |
| `404` | Feature disabled | — |
| `503` | analytics_store_unavailable | — |

Response `200` fields:

- `application/json`: object
  - `data` (array of [EvaluationResult](/docs/api/schemas/e/#evaluationresult), required)
  - `limit` (integer, required)
  - `next_cursor` (string) — Present when a later page exists.


## POST /api/v1/admin/evaluations

`POST /api/v1/admin/evaluations` · operation `createEvaluation`

A reviewer's result (source human) on a span, trace, session, request, run item or run of a team the session administers, with the validation of POST /v1/scores plus team_id. A result on a trace is one per reviewer, trace and name: a second write updates it (a new revision, audited eval.result_edit) and answers the same ID, so two clicks at once leave one result; a reviewer's result recorded before this rule keeps its ID, a second write without a comment keeps the comment (PATCH clears it); the first write is audited eval.result_create. Requires evals, evaluation_results, evals:manage and the team's plan.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: [EvaluationResultInput](/docs/api/schemas/e/#evaluationresultinput) and object
  - All of (1): [EvaluationResultInput](/docs/api/schemas/e/#evaluationresultinput)
  - All of (2): object
    - `team_id` (string, required)

**Responses**

| Status | Description | Body |
|---|---|---|
| `201` | Created; a join key on several requests answers {"data":[...]}, one result per request | `application/json`: [EvaluationResult](/docs/api/schemas/e/#evaluationresult) or object |
| `400` | invalid_score with the reason | — |
| `403` | team_forbidden or entitlement_forbidden | — |
| `404` | Feature disabled | — |
| `409` | duplicate | — |

Response `201` fields:

- `application/json`: [EvaluationResult](/docs/api/schemas/e/#evaluationresult) or object
  - One of (1): [EvaluationResult](/docs/api/schemas/e/#evaluationresult)
  - One of (2): object
    - `data` (array of [EvaluationResult](/docs/api/schemas/e/#evaluationresult))


## GET /api/v1/admin/evaluations/backfill

`GET /api/v1/admin/evaluations/backfill` · operation `getEvaluationBackfill`

Progress of the background migration of older scores to evaluation results (500 rows every 2 s while evaluation_results is on; resumable). Requires evals, evaluation_results and evals:read.

**Authentication:** `adminSession`

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Progress | `application/json`: object |
| `404` | Feature disabled | — |

Response `200` fields:

- `application/json`: object
  - `started_at` (string (date-time))
  - `finished_at` (string (date-time)) — Set once no unmigrated score is left.
  - `migrated` (integer, required)
  - `batches` (integer, required)
  - `remaining` (integer, required)
  - `last_error` (string)
  - `updated_at` (string (date-time))


## GET /api/v1/admin/usage/origin-backfill

`GET /api/v1/admin/usage/origin-backfill` · operation `getUsageOriginBackfill`

Progress of the background pass that gives older request log rows their origin (T186.004). While evaluation_tracing is on, rows written before it are classified as evaluation, experiment or playground only from the pair of identifiers the gateway mints for its own calls (the in-process caller key and the request ID it gave the call); every other row stays without an origin and reads as app. Resumable: the cursor is stored with each pass and replicas take turns. Requires evals, evaluation_results, evaluation_tracing, evals:read and a global role.

**Authentication:** `adminSession`

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Progress | `application/json`: object |
| `403` | A global role reads it (global_role_required) | — |
| `404` | Feature disabled | — |

Response `200` fields:

- `application/json`: object
  - `cursor` (integer (int64), required) — The request log identifier the pass has reached
  - `target` (integer (int64), required) — The newest request log identifier now
  - `started_at` (string (date-time))
  - `finished_at` (string (date-time))
  - `classified` (integer (int64), required) — Rows given an origin
  - `batches` (integer (int64), required)
  - `last_error` (string)
  - `updated_at` (string (date-time))
  - `done` (boolean, required)


## GET /api/v1/admin/evaluations/{id}

`GET /api/v1/admin/evaluations/{id}` · operation `getEvaluation`

One evaluation result in the session's teams; another team's answers 404. Requires evals, evaluation_results and evals:read.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | The result | `application/json`: [EvaluationResult](/docs/api/schemas/e/#evaluationresult) |
| `404` | Not found or feature disabled | — |
| `503` | analytics_store_unavailable | — |


## PATCH /api/v1/admin/evaluations/{id}

`PATCH /api/v1/admin/evaluations/{id}` · operation `patchEvaluation`

Edits a result: the earlier values are kept as a revision, the result reads edited, the edit is audited (eval.result_edit, target &lt;id&gt;@&lt;revision&gt;). revision, when sent, must be the current one (409 revision_conflict). valid false withdraws the result from lists and counts. Requires evals, evaluation_results and evals:manage.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object
  - `value` (number)
  - `string_value` (string)
  - `value_json` (any) — A JSON value up to 8 KiB.
  - `assessment` (string, one of `"pass"`, `"fail"`, `"none"`)
  - `comment` (string, max length 2000)
  - `valid` (boolean)
  - `reason` (string, max length 500)
  - `revision` (integer, min 0)

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | The edited result | `application/json`: [EvaluationResult](/docs/api/schemas/e/#evaluationresult) |
| `400` | Invalid input | — |
| `404` | Not found or feature disabled | — |
| `409` | revision_conflict | — |
| `503` | analytics_store_unavailable | — |


## GET /api/v1/admin/evaluations/{id}/revisions

`GET /api/v1/admin/evaluations/{id}/revisions` · operation `listEvaluationRevisions`

The earlier values of a result, oldest first: each revision is what the result was before the edit that produced the next. Requires evals, evaluation_results and evals:read.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Revisions | `application/json`: object |
| `404` | Not found or feature disabled | — |

Response `200` fields:

- `application/json`: object
  - `evaluation_id` (string, required)
  - `revision` (integer, required) — The current revision.
  - `data` (array of object, required)
    - `evaluation_id` (string)
    - `team_id` (string)
    - `revision` (integer)
    - `value` (number)
    - `string_value` (string)
    - `value_json` (any)
    - `assessment` (string)
    - `status` (string)
    - `comment` (string)
    - `valid` (boolean)
    - `edited_by` (string)
    - `edited_at` (string (date-time))
    - `reason` (string)


## GET /api/v1/admin/evals/comments

`GET /api/v1/admin/evals/comments` · operation `listEvalComments`

Comment thread of one target, oldest first, up to 200 (ADR 0153). Requires evals and evals:read on the team.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `team_id` | query | string, required | The team that owns the target. |
| `target_type` | query | string, required, one of `"request"`, `"session"`, `"run_item"`, `"prompt"` | Kind of the commented target: request, session, run_item or prompt. |
| `target_id` | query | string, required | Request ID, session ID, run_id/item_id or prompt ID |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | — |
| `404` | Feature disabled, target not found or team not visible | — |


## POST /api/v1/admin/evals/comments

`POST /api/v1/admin/evals/comments` · operation `createEvalComment`

Adds a comment (1-3000 characters, trimmed) to a captured request, a session or a run item of the team (ADR 0153), or to a prompt of the team with the prompt registry on (ADR 0155). The author is the console user. A token `@[Name](user:usr_…)` mentions a console user (ADR 0161): up to 20 per comment, each one able to read the team's comments, or the call fails with invalid_mention; everyone mentioned but the author gets the comment in the mentions inbox. Requires evals and evals:manage.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object
  - `team_id` (string, required)
  - `target_type` (string, required, one of `"request"`, `"session"`, `"run_item"`, `"prompt"`)
  - `target_id` (string, required)
  - `content` (string, required, max length 3000)

**Responses**

| Status | Description | Body |
|---|---|---|
| `201` | Created | — |
| `400` | Invalid content, target or mention | — |
| `404` | Feature disabled or not visible | — |


## GET /api/v1/admin/evals/mentionable

`GET /api/v1/admin/evals/mentionable` · operation `listEvalMentionable`

Console users who can read the team's comments on that kind of target, as id and name, for the mention autocomplete (ADR 0161). Empty without console_users. Requires evals and evals:read on the team.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `team_id` | query | string, required | The team whose comment readers are listed. |
| `target_type` | query | string, one of `"request"`, `"session"`, `"run_item"`, `"prompt"` | Only users who can read comments on this kind of target. |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | — |
| `404` | Feature disabled or team not visible | — |


## GET /api/v1/admin/evals/mentions

`GET /api/v1/admin/evals/mentions` · operation `listEvalMentions`

Mentions inbox of the session user (ADR 0161): comments that mention them, newest first, up to 200, in teams they can still read, each with read_at; unread counts the ones not read. A removed comment leaves the inbox. The bootstrap administrator has none. Requires evals and evals:read.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `unread` | query | boolean | true lists only the mentions not yet marked as read. |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | — |
| `404` | Feature disabled | — |


## POST /api/v1/admin/evals/mentions/read

`POST /api/v1/admin/evals/mentions/read` · operation `readEvalMentions`

Marks the session user's mentions of the listed comments as read, or all of them when comment_ids is empty (ADR 0161). Returns how many changed. Requires evals and evals:read.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object
  - `comment_ids` (array of string, max items 200)

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | — |
| `400` | Invalid input | — |
| `404` | Feature disabled | — |


## DELETE /api/v1/admin/evals/comments/{id}

`DELETE /api/v1/admin/evals/comments/{id}` · operation `deleteEvalComment`

Removes a comment. Only its author or a global administrator may (ADR 0153).

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Responses**

| Status | Description | Body |
|---|---|---|
| `204` | Deleted | — |
| `403` | Not the author | — |
| `404` | Comment not found | — |


## GET /api/v1/admin/evals/datasets

`GET /api/v1/admin/evals/datasets` · operation `listEvalDatasets`

Datasets with current item counts. Requires evals and evals:read; team roles are limited to their teams.

**Authentication:** `adminSession`

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | — |
| `400` | Invalid input | — |
| `404` | Feature disabled or not visible | — |


## POST /api/v1/admin/evals/datasets

`POST /api/v1/admin/evals/datasets` · operation `createEvalDataset`

team_id, name, description and optional input_schema / expected_schema (supported JSON Schema subset), enforced on every item write. Requires evals and evals:manage; team roles are limited to their teams.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object

**Responses**

| Status | Description | Body |
|---|---|---|
| `201` | Created | — |
| `400` | Invalid input | — |
| `404` | Feature disabled or not visible | — |


## GET /api/v1/admin/evals/datasets/{id}

`GET /api/v1/admin/evals/datasets/{id}` · operation `getEvalDataset`

Dataset and its items; as_of (RFC 3339) reads the items valid at that instant. Requires evals and evals:read; team roles are limited to their teams.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |
| `as_of` | query | string (date-time) |  |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | — |
| `400` | Invalid input | — |
| `404` | Feature disabled or not visible | — |


## PUT /api/v1/admin/evals/datasets/{id}/items/{item}

`PUT /api/v1/admin/evals/datasets/{id}/items/{item}` · operation `putEvalDatasetItem`

Creates or replaces an item (input, expected_output, metadata; 256 KiB). Each change closes the previous version. Requires evals and evals:manage; team roles are limited to their teams.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |
| `item` | path | string, required, pattern `^[A-Za-z0-9_.-]{1,64}$` |  |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | — |
| `400` | Invalid input | — |
| `404` | Feature disabled or not visible | — |


## DELETE /api/v1/admin/evals/datasets/{id}/items/{item}

`DELETE /api/v1/admin/evals/datasets/{id}/items/{item}` · operation `archiveEvalDatasetItem`

Archives an item; past versions stay readable with as_of. Requires evals and evals:manage; team roles are limited to their teams.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |
| `item` | path | string, required, pattern `^[A-Za-z0-9_.-]{1,64}$` |  |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Responses**

| Status | Description | Body |
|---|---|---|
| `204` | Archived | — |
| `400` | Invalid input | — |
| `404` | Feature disabled or not visible | — |


## POST /api/v1/admin/evals/datasets/{id}/items/import

`POST /api/v1/admin/evals/datasets/{id}/items/import` · operation `importEvalDatasetItems`

Imports up to 1000 items from a CSV (1 MiB) in one transaction: any bad line rejects the whole file and the error names the line. Header columns: input (required), expected_output, metadata (a JSON object) and id. A cell that is valid JSON keeps its type; any other text becomes a JSON string. Rows without id get a stable ID from the input, so importing the same file again versions the same items. The dataset schemas apply to every row. With Content-Type application/json the body is a JSON array of {id, input, expected_output, metadata} under the same rules (T186.012: the console export's format). With experiment_traces the import is one version of the dataset and ?note= names it. Requires evals and evals:manage; team roles are limited to their teams.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |
| `note` | query | string, max length 500 | experiment_traces: the note of the version this import makes |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `text/csv`: string
- `application/json`: array of object
  - `id` (string)
  - `input` (any, required)
  - `expected_output` (any)
  - `metadata` (object)

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Imported: {imported, items} | — |
| `400` | Invalid CSV, line or schema violation | — |
| `404` | Feature disabled or not visible | — |
| `413` | CSV above 1 MiB | — |


## POST /api/v1/admin/evals/datasets/{id}/items/from-captures

`POST /api/v1/admin/evals/datasets/{id}/items/from-captures` · operation `addEvalDatasetItemsFromCaptures`

Turns 1-100 captured requests (eval_capture) of the dataset team into items, in one transaction: input is {"messages": captured conversation}, expected_output is the captured answer unless include_output is false, and metadata records source, request_id and model. The item ID is req-&lt;request_id&gt;, so adding a capture again versions the same item. Requires evals and evals:manage; team roles are limited to their teams.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object
  - `request_ids` (array of string, required, min items 1, max items 100)
  - `include_output` (boolean, default `true`)

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Added: {added, items} | — |
| `400` | Invalid input or schema violation | — |
| `404` | Feature disabled, dataset not visible, or capture missing or expired | — |
| `409` | Capture of another team, or no longer decryptable | — |


## GET /api/v1/admin/evals/datasets/{id}/versions

`GET /api/v1/admin/evals/datasets/{id}/versions` · operation `listEvalDatasetVersions`

T186.012 (experiment_traces). The dataset's versions, newest first: every instant at which items were added, changed or removed, numbered from the oldest (1), with the counts of that change, the number of items after it and, for a write made with the flag on, who made it (actor), through what (source: manual, csv, capture, span, restore) and its note. A write of several items (a CSV, captures, spans) is one version; writes made before migration 285 opened one version per item. Requires experiment_traces in the dataset team's plan, evals and evals:read (404 feature_disabled otherwise).

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |
| `limit` | query | integer, default `500`, min 1, max 500 |  |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | The versions | `application/json`: object |
| `404` | Feature disabled or not in the team's plan, or the dataset is not visible | — |

Response `200` fields:

- `application/json`: object
  - `dataset_id` (string, required)
  - `total` (integer, required)
  - `versions` (array of object, required, max items 500)
    - `version` (integer, required)
    - `at` (string (date-time), required) — The instant; read the dataset or run an experiment as of it
    - `added` (integer, required)
    - `changed` (integer, required)
    - `removed` (integer, required)
    - `items` (integer, required)
    - `actor` (string)
    - `source` (string)
    - `note` (string, max length 500)


## POST /api/v1/admin/evals/datasets/{id}/version-notes

`POST /api/v1/admin/evals/datasets/{id}/version-notes` · operation `setEvalDatasetVersionNote`

T186.012 (experiment_traces). Names a version (a tag such as golden-2026-11, or what changed); an empty note removes it. Requires evals:manage over the dataset's team.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object
  - `at` (string (date-time), required)
  - `note` (string, required, max length 500)

**Responses**

| Status | Description | Body |
|---|---|---|
| `204` | Saved | — |
| `400` | Invalid instant or note | — |
| `404` | Not a version of the dataset, or not visible | — |


## GET /api/v1/admin/evals/datasets/{id}/diff

`GET /api/v1/admin/evals/datasets/{id}/diff` · operation `diffEvalDatasetVersions`

T186.012 (experiment_traces). Compares the items valid at from with those valid at to: each added, removed or changed item with the fields that differ (input, expected_output, metadata) and both versions. JSON is compared as stored, so key order is not a change. Requires evals:read.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |
| `from` | query | string (date-time), required |  |
| `to` | query | string (date-time) | Defaults to now |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | {dataset_id, from, to, summary {added, changed, removed}, changes [{item_id, change, fields, before, after}]} | — |
| `400` | from missing or not before to | — |
| `404` | Feature disabled or dataset not visible | — |


## GET /api/v1/admin/evals/datasets/{id}/items/{item}/history

`GET /api/v1/admin/evals/datasets/{id}/items/{item}/history` · operation `getEvalDatasetItemHistory`

T186.012 (experiment_traces). Every version of the item, newest first (valid_from, valid_to, source, source_trace_id, source_span_id, created_by), and the runs of the session's teams that ran it with each run item's status, trace, request and the item version it ran. Requires evals:read.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |
| `item` | path | string, required, pattern `^[A-Za-z0-9_.-]{1,64}$` |  |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | {dataset_id, item_id, versions, runs} | — |
| `404` | Feature disabled, dataset not visible or no such item | — |


## POST /api/v1/admin/evals/datasets/{id}/items/{item}/restore

`POST /api/v1/admin/evals/datasets/{id}/items/{item}/restore` · operation `restoreEvalDatasetItem`

T186.012 (experiment_traces). Writes an earlier version of the item as its new current version (source restore, note naming the version): history is never rewritten. The version must still match the dataset's schema. Requires evals:manage.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |
| `item` | path | string, required |  |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object
  - `valid_from` (string (date-time), required)

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | The new version | — |
| `404` | No such version, or not visible | — |
| `409` | That version is the current one | — |


## POST /api/v1/admin/evals/datasets/{id}/items/from-spans

`POST /api/v1/admin/evals/datasets/{id}/items/from-spans` · operation `addEvalDatasetItemsFromSpans`

T186.012 (experiment_traces, span_store). Adds the captured request of each span (a request or provider attempt span of the dataset's team) to the dataset, read as Add from captures reads it (sent view, audited, content_sent:read): input is the conversation (input messages, the default) or the text of its last user message (input last_user), expected_output the captured answer unless include_output is false. The item is span-&lt;span_id&gt;, source span, with source_trace_id and source_span_id. dry_run answers the items without writing them, for a preview of the mapping. One write, one version, with the optional note.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object
  - `spans` (array of object, required, min items 1, max items 100)
    - `trace_id` (string, required, min length 32, max length 32)
    - `span_id` (string, required, min length 16, max length 16)
  - `include_output` (boolean, default `true`)
  - `input` (string, one of `"messages"`, `"last_user"`, default `"messages"`)
  - `dry_run` (boolean, default `false`)
  - `note` (string, max length 500)

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | {added, items, dry_run} | — |
| `403` | content_sent:read missing for the team | — |
| `404` | Feature disabled, dataset not visible, span of another team or capture missing | — |
| `409` | Capture of another team, or not readable for evaluation | — |


## GET /api/v1/admin/evals/runs/{id}/traces

`GET /api/v1/admin/evals/runs/{id}/traces` · operation `listEvalRunTraces`

T186.012 (experiment_traces). The traces of a traced run's items (one per item) and the trace query that lists them in Traces (origin:experiment request_id:"eval.&lt;run&gt;."*). Requires evals:read.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | {run_id, trace_ids (at most 2000), query} | — |
| `404` | Feature disabled or run not visible | — |


## GET /api/v1/admin/evals/runs/{id}/evaluations

`GET /api/v1/admin/evals/runs/{id}/evaluations` · operation `listEvalRunEvaluations`

T186.012 (experiment_traces). The run's evaluations again, newest first (50): status, items judged and failed, and the evaluators (id, name, version, judge_model; never the prompt). Requires evals:read.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | {run_id, evaluations} | — |
| `404` | Feature disabled or run not visible | — |


## POST /api/v1/admin/evals/runs/{id}/evaluations

`POST /api/v1/admin/evals/runs/{id}/evaluations` · operation `createEvalRunEvaluation`

T186.012 (experiment_traces). Judges the completed items of a finished run (or item_ids among them) again with 1-10 evaluators of the run's team, as a leased background job: each result keeps the deterministic ID of its run, item and evaluator, so the item ends with one valid result per evaluator, and a traced run's judges nest in the item's trace. The judge calls are the run's (principal eval:&lt;run&gt;) and count in its cost. dry_run answers the estimate only: items, judge calls, code checks, and the estimated spend from each evaluator's average judge cost of the last 7 days in the ledger (state known, partial or unknown when an evaluator has no priced history). The evaluators join the run's evaluator list. Requires evals:manage over the run's team.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object
  - `evaluator_ids` (array of string, required, min items 1, max items 10)
  - `item_ids` (array of string, max items 2000)
  - `dry_run` (boolean, default `false`)

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | dry_run: {run_id, estimate} | — |
| `201` | {evaluation, estimate} | — |
| `400` | Invalid evaluator or nothing to judge | — |
| `404` | Feature disabled, run or evaluator not visible | — |
| `409` | The run has not finished | — |


## POST /api/v1/admin/evals/runs/{id}/evaluations/{evaluation}/cancel

`POST /api/v1/admin/evals/runs/{id}/evaluations/{evaluation}/cancel` · operation `cancelEvalRunEvaluation`

T186.012 (experiment_traces). Stops a run evaluation; results already written stay. Requires evals:manage.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |
| `evaluation` | path | string, required |  |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Responses**

| Status | Description | Body |
|---|---|---|
| `204` | Canceled | — |
| `404` | Not visible | — |


## GET /api/v1/admin/evals/suites

`GET /api/v1/admin/evals/suites` · operation `listEvalSuites`

T186.012 (regression_suites, experiment_traces). The regression suites of the session's teams whose plan includes both. Requires evals:read.

**Authentication:** `adminSession`

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | {data: [EvalSuite]} | — |
| `404` | Feature disabled | — |


## POST /api/v1/admin/evals/suites

`POST /api/v1/admin/evals/suites` · operation `createEvalSuite`

T186.012 (regression_suites). A suite runs a dataset of its team against an enabled chat alias (and optionally a prompt revision) with 1-20 assertions: an evaluator of the team with pass criteria (passes when its result is assessed pass) or a sentence (text) the judge_model alias decides true or false. Each item runs runs_per_item trials (1-5, default 1) and passes when at least pass_threshold of them (default runs_per_item) pass every assertion that applies to it; the suite passes when the share of passing items reaches min_pass_rate (0-1, default 1). An item adds up to 5 assertions of its own in its metadata (assertions: [{name, text}] or [{name, evaluator}] by evaluator name) and may override the trials (execution_policy: {runs_per_item, pass_threshold}). Requires evals:manage over the team and both flags in its plan (403 entitlement_forbidden).

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: [EvalSuiteInput](/docs/api/schemas/e/#evalsuiteinput)

**Responses**

| Status | Description | Body |
|---|---|---|
| `201` | The suite | — |
| `400` | Invalid suite | — |
| `403` | Team outside the session, or plan without the flags | — |
| `409` | A suite of the team already has this name | — |


## GET /api/v1/admin/evals/suites/{id}

`GET /api/v1/admin/evals/suites/{id}` · operation `getEvalSuite`

T186.012 (regression_suites). The suite and its last 20 runs, each with its verdict. Requires evals:read.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | {suite, runs} | — |
| `404` | Not visible | — |


## PUT /api/v1/admin/evals/suites/{id}

`PUT /api/v1/admin/evals/suites/{id}` · operation `updateEvalSuite`

T186.012 (regression_suites). Replaces what the suite runs and asserts (its team and dataset stay) and increments its version; earlier runs keep the snapshot they ran. Requires evals:manage.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: [EvalSuiteInput](/docs/api/schemas/e/#evalsuiteinput)

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | The suite | — |
| `400` | Invalid suite | — |
| `404` | Not visible | — |


## DELETE /api/v1/admin/evals/suites/{id}

`DELETE /api/v1/admin/evals/suites/{id}` · operation `deleteEvalSuite`

T186.012 (regression_suites). Removes the suite; its runs stay. Audited (eval.suite.delete). Requires evals:manage.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Responses**

| Status | Description | Body |
|---|---|---|
| `204` | Removed | — |
| `404` | Not visible | — |


## POST /api/v1/admin/evals/suites/{id}/runs

`POST /api/v1/admin/evals/suites/{id}/runs` · operation `runEvalSuite`

T186.012 (regression_suites). Starts a run of the suite on the dataset as it is now: a traced experiment run (suite_id set) with every trial as a run item (&lt;item&gt;:t&lt;n&gt; with more than one trial) and a snapshot of the suite. Requires evals:manage.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Responses**

| Status | Description | Body |
|---|---|---|
| `201` | The run | — |
| `400` | The suite can no longer run (alias, evaluator or item assertion invalid, more than 2000 trials) | — |
| `404` | Not visible | — |


## GET /api/v1/admin/evals/suite-runs/{run}

`GET /api/v1/admin/evals/suite-runs/{run}` · operation `getEvalSuiteRunVerdict`

T186.012 (regression_suites). The verdict of a suite run (SuiteVerdict). Requires evals:read.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `run` | path | string, required |  |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | The verdict | `application/json`: [SuiteVerdict](/docs/api/schemas/s/#suiteverdict) |
| `404` | Not visible | — |


## GET /api/v1/admin/evals/remote-endpoints

`GET /api/v1/admin/evals/remote-endpoints` · operation `listEvalRemoteEndpoints`

T186.012b (remote_experiments, experiment_traces). The remote endpoints of the session's teams whose plan includes both (never their signing secret), and the configured bounds (evaluation.remote_experiments). Requires evals:read.

**Authentication:** `adminSession`

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | {data: [{id, team_id, name, url, mode, batch_size, timeout_ms, max_retries, concurrency, version}], bounds} | — |
| `404` | Feature disabled | — |


## POST /api/v1/admin/evals/remote-endpoints

`POST /api/v1/admin/evals/remote-endpoints` · operation `createEvalRemoteEndpoint`

T186.012b (remote_experiments). A team's endpoint that executes the items of remote experiments: an https URL (plain http only to loopback with allow_loopback_http), checked again by the outbound guard on every call (no private address outside allowed_private_cidrs). mode sync: the endpoint answers {outputs: [{item_id, output, error, latency_ms}]}; mode callback: it answers 2xx and posts the outputs to POST /v1/eval-remote/runs/{run}/items with the run's token. batch_size, timeout_ms, max_retries and concurrency are bounded by evaluation.remote_experiments. Calls carry X-Gateway-Signature (t=&lt;unix&gt;,v1=&lt;hex HMAC-SHA256 of "&lt;t&gt;.&lt;body&gt;" with the endpoint's signing secret), X-Gateway-Run-Id and Idempotency-Key. The signing secret is answered once (whsec_…) and stored encrypted. Requires evals:manage over the team and both flags in its plan.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object
  - `team_id` (string, required)
  - `name` (string, required, max length 80)
  - `url` (string, required, max length 2048)
  - `mode` (string, one of `"sync"`, `"callback"`, default `"sync"`)
  - `batch_size` (integer, default `1`, min 1, max 100)
  - `timeout_ms` (integer, min 1000, max 600000)
  - `max_retries` (integer, min 0, max 10)
  - `concurrency` (integer, min 1, max 64)

**Responses**

| Status | Description | Body |
|---|---|---|
| `201` | {endpoint, signing_secret} | — |
| `400` | Invalid endpoint or URL | — |
| `403` | Team outside the session, or plan without the flags | — |


## PUT /api/v1/admin/evals/remote-endpoints/{id}

`PUT /api/v1/admin/evals/remote-endpoints/{id}` · operation `updateEvalRemoteEndpoint`

T186.012b. Changes an endpoint's name, URL, mode and bounds (its team stays); the secret is kept. Requires evals:manage.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | The endpoint | — |
| `400` | Invalid endpoint | — |
| `404` | Not visible | — |


## DELETE /api/v1/admin/evals/remote-endpoints/{id}

`DELETE /api/v1/admin/evals/remote-endpoints/{id}` · operation `deleteEvalRemoteEndpoint`

T186.012b. Removes an endpoint; a run still executing on it fails. Requires evals:manage.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Responses**

| Status | Description | Body |
|---|---|---|
| `204` | Removed | — |
| `404` | Not visible | — |


## POST /api/v1/admin/evals/remote-endpoints/{id}/rotate-secret

`POST /api/v1/admin/evals/remote-endpoints/{id}/rotate-secret` · operation `rotateEvalRemoteEndpointSecret`

T186.012b. A new signing secret, answered once; the old one stops at once. Requires evals:manage.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | {endpoint, signing_secret} | — |
| `404` | Not visible | — |


## Read an agent evaluation and its scorecard (console)

`GET /api/v1/admin/evals/agent-evals/{id}` · operation `getAgentEvalAdmin`

T201 (agent_evaluations). The body of GET /v1/agent-evals/{id} for a console reader of the evaluation's team whose plan includes agent_evaluations and experiment_traces. Requires evals:read; another team's evaluation answers 404.

**Authentication:** `bearerAuth`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |
| `trials` | query | string |  |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | The plan and its scorecard | `application/json`: [AgentEvalScorecardRead](/docs/api/schemas/a/#agentevalscorecardread) |
| `404` | Feature disabled, not in the team's plan, or not found | — |


## GET /api/v1/admin/evals/runs/{id}/trials

`GET /api/v1/admin/evals/runs/{id}/trials` · operation `getEvalRunTrials`

T186.012b (experiment_traces). Per dataset item, its trials' mean and standard deviation per evaluator, its passing trials and pass@k (at least one trial passed) and pass^k (every trial passed) where the evaluator assesses; per evaluator, the share of items passing at least once and every time. Requires evals:read.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | {run_id, trials, items: [{item_id, trials, completed, evaluators}], evaluators: {name: {items, pass_at_k, pass_all_k}}} | — |
| `404` | Feature disabled or run not visible | — |


## GET /api/v1/admin/evals/runs/{id}/sessions

`GET /api/v1/admin/evals/runs/{id}/sessions` · operation `getEvalRunSessions`

T186.012b (experiment_traces). The run's sessions (items with metadata.session_id, one conversation each, a trial its own session &lt;session&gt;:t&lt;n&gt;), their items in order and the results of the per-session judges (target session exp:&lt;run&gt;:&lt;session&gt;). The calls carry X-Gateway-Session-Id exp-&lt;run&gt;-&lt;session&gt;, so Traces → Sessions shows each conversation. Requires evals:read.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | {run_id, sessions: [{session_id, items, completed, results}], session_header} | — |
| `404` | Feature disabled or run not visible | — |


## GET /api/v1/admin/evals/summary-settings

`GET /api/v1/admin/evals/summary-settings` · operation `listEvalSummarySettings`

T186.012b (experiment_summaries). The chat alias each of the session's teams chose for comparison summaries. There is no default. Requires evals:read.

**Authentication:** `adminSession`

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | {items: [{team, model, updated_at, updated_by}]} | — |
| `404` | Feature disabled | — |


## PUT /api/v1/admin/evals/summary-settings/{team}

`PUT /api/v1/admin/evals/summary-settings/{team}` · operation `setEvalSummaryModel`

T186.012b. Chooses a team's summary alias: an enabled chat alias that is not an automatic route. Requires evals:manage over the team and experiment_summaries in its plan. Audited.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `team` | path | string, required |  |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object
  - `model` (string, required)

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | {team, model} | — |
| `400` | Not an enabled chat alias | — |
| `403` | Team outside the session, or plan without the flag | — |


## DELETE /api/v1/admin/evals/summary-settings/{team}

`DELETE /api/v1/admin/evals/summary-settings/{team}` · operation `deleteEvalSummaryModel`

T186.012b. Removes a team's choice, and with it summaries for the team. Requires evals:manage.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `team` | path | string, required |  |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Responses**

| Status | Description | Body |
|---|---|---|
| `204` | Removed | — |
| `404` | No choice to remove | — |


## POST /api/v1/admin/evals/compare-summary

`POST /api/v1/admin/evals/compare-summary` · operation `createEvalCompareSummary`

T186.012b (experiment_summaries). A short summary of 2-5 runs of one dataset and one team, generated through the team's chosen alias (409 summary_not_configured without one). It reads only the runs' figures (items, failures, latency, each evaluator's mean, pass rate, labels and improved/regressed counts against the baseline), never an item's input, output or captured content, and nothing is stored. dry_run answers the alias and the estimate (input tokens, max output tokens and, for readers who see costs and a priced alias, max_usd). The call is an experiment_summary helper call of the team (parent: this request), recorded and priced like every call. Requires evals:manage.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object
  - `runs` (array of string, required, min items 2, max items 5)
  - `baseline` (string)
  - `dry_run` (boolean)

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | {model, estimate} or {model, request_id, summary, input_tokens, output_tokens, estimate} | — |
| `404` | Feature disabled or runs not visible | — |
| `409` | summary_not_configured | — |
| `502` | The summary call failed | — |


## GET /api/v1/admin/evals/evaluators

`GET /api/v1/admin/evals/evaluators` · operation `listEvalEvaluators`

LLM-as-judge evaluators. Requires evals and evals:read; team roles are limited to their teams. With evaluation_results, external lists the result names the API and feedback wrote with no evaluator (T186.003): team_id, name, first_seen, metric_type, scopes, sources, results, pass, fail, errors and pass_rate (pass/(pass+fail) over ok results). Evaluator output may carry pass criteria: {op: gte|gt|lte|lt|eq, value} for numeric and boolean outputs, {labels: [...]} for categorical. With evaluation_tracing (T186.004), health maps each evaluator ID of a team whose plan includes it to: state (ok, degraded or blocked), reason, window_hours (24) with results, errors, skipped and error_rate (errors over ok plus errors), last_result_at, cost_window_days (7) with results_7d, errors_7d, skipped_7d and, for readers who may see costs, cost_7d ({state, known_usd, requests, unvalued_requests} from the ledger rows of the evaluator's judge requests), input_tokens_7d, output_tokens_7d and cost_per_result_usd. blocked: a rule was auto-paused; degraded: at least 5% of the judged results of the last 24 hours are errors. With evaluators (T186.008), each evaluator of a team whose plan includes it also carries its live configuration and state (EvaluatorRecord: type, scope, filter, sample_rate, runs_on, tracing, status, paused_reason, published_version, managed_by, updated_at), figures maps each evaluator ID to results_7d, pass_rate and daily (the judged results of each of the last 7 UTC days), and live maps each published evaluator ID to what its published version runs on live traffic (version, scope, filter, sample_rate, runs_on), since the row itself is the latest definition and may be a draft ahead of it.

**Authentication:** `adminSession`

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | — |
| `400` | Invalid input | — |
| `404` | Feature disabled or not visible | — |


## POST /api/v1/admin/evals/evaluators

`POST /api/v1/admin/evals/evaluators` · operation `createEvalEvaluator`

team_id, name (the score name), judge_model (enabled chat alias, or a decision alias with systemone for boolean or categorical scores, ADR 0149), prompt, output (boolean, numeric with min/max, or categorical) and optional variables. The prompt reads {{input}}, {{output}} and {{expected}} as they are; any other {{name}} needs variables.name = {from: input|output|expected|metadata, path: optional JSONPath subset with .key, ['key'] and [index] steps, negative index from the end}. Metadata is the dataset item metadata in runs and the request body metadata in the evaluator test. Every variable in the prompt needs a source, every mapped name must appear, and the judge must read the answer (ADR 0130). A code evaluator (ADR 0148) sends rule instead of judge_model, prompt and variables: {type: exact_match|contains|not_contains|regex|json_valid|json_field_equals|length_between, value, pattern, path, min, max, case_insensitive}; it never calls a model and scores boolean or numeric (a pass is true or max). A judge may add messages (ADR 0122, judge roles): an optional system prompt first, then up to 20 user and assistant few-shot turns ending with the assistant, 40000 characters in all; variables work in them as in the prompt, the system prompt comes before the gateway's JSON rule and the prompt stays the last user turn. Code and decision judges take no messages. multimodal true (ADR 0122) sends the judge the images of the input with the prompt: OpenAI content parts image_url or input_image at any depth, https or data:image only, at most five; the judge model must accept images. include_reasoning true (T186.005, default false) also gives the judge of a live rule the model's reasoning, kept apart from the answer by content_capture_reasoning, after the prompt and labelled as not part of the answer; a code evaluator takes none (400). Requires evals and evals:manage; team roles are limited to their teams.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object

**Responses**

| Status | Description | Body |
|---|---|---|
| `201` | Created | — |
| `400` | Invalid input | — |
| `404` | Feature disabled or not visible | — |


## POST /api/v1/admin/evals/evaluators/test

`POST /api/v1/admin/evals/evaluators/test` · operation `testEvalEvaluator`

Runs a judge definition on one sample through the gateway and returns the score and explanation without storing anything. Body: evaluator, input, output, expected_output and metadata (read by variables mapped from metadata). Requires evals and evals:manage; team roles are limited to their teams.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Verdict | — |
| `400` | Invalid input | — |
| `404` | Feature disabled or not visible | — |
| `502` | judge_failed | — |


## GET /api/v1/admin/evals/evaluators/{id}

`GET /api/v1/admin/evals/evaluators/{id}` · operation `getEvalEvaluator`

Evaluators (T186.008). One evaluator with its live configuration (scope, filter, sample_rate, runs_on, tracing, model parameters, daily cost ceiling, idle override), its status (draft, active, paused, disabled), paused_reason, published_version, draft_ahead (the latest version is newer than the published one) and, for a trace or session evaluator, effective_idle_seconds. Requires evals:read.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required | Evaluator ID |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | The evaluator | `application/json`: [EvaluatorRecord](/docs/api/schemas/e/#evaluatorrecord) |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | evaluators disabled or not in the team's plan (feature_disabled), or an evaluator outside the session's teams and organization (not_found) | — |


## PUT /api/v1/admin/evals/evaluators/{id}

`PUT /api/v1/admin/evals/evaluators/{id}` · operation `updateEvalEvaluator`

A changed definition is a new version; runs keep the version they used. With evaluators (T186.008) the save is a draft: it carries the live configuration (EvaluatorDefinition), is recorded with its readable spec, and never changes the status or the published version, so live traffic keeps the published version until POST .../publish; a name another evaluator of the team holds is refused (409 duplicate_name), as is an evaluator the configuration file declares (409 managed_by_configuration). Without the flag a v2 field is refused (400). Requires evals and evals:manage; team roles are limited to their teams.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | — |
| `400` | Invalid input | — |
| `404` | Feature disabled or not visible | — |


## DELETE /api/v1/admin/evals/evaluators/{id}

`DELETE /api/v1/admin/evals/evaluators/{id}` · operation `deleteEvalEvaluator`

Deletes an evaluator; past runs keep their snapshot. Requires evals and evals:manage; team roles are limited to their teams.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Responses**

| Status | Description | Body |
|---|---|---|
| `204` | Deleted | — |
| `400` | Invalid input | — |
| `404` | Feature disabled or not visible | — |
| `409` | evaluator_in_use (T186.015): an enabled judge guardrail runs the evaluator | — |


## GET /api/v1/admin/evals/evaluators/{id}/versions

`GET /api/v1/admin/evals/evaluators/{id}/versions` · operation `listEvalEvaluatorVersions`

Evaluators (T186.008). The versions of an evaluator, newest first (up to 500): every save is one. Each has version, source (save, restore, migration, recovered_from_run, rule_fold), note, created_by, created_at, restored_from, published (it is the version live traffic runs), published_at and published_by. Also answers the latest version and the published_version. Requires evals:read.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required | Evaluator ID |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | — |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | evaluators disabled or not in the team's plan (feature_disabled), or an evaluator outside the session's teams and organization (not_found) | — |


## GET /api/v1/admin/evals/evaluators/{id}/versions/{version}

`GET /api/v1/admin/evals/evaluators/{id}/versions/{version}` · operation `getEvalEvaluatorVersion`

Evaluators (T186.008). One version with its definition (spec: every field of the definition, model parameters included, and never the evaluator's status) and its readable spec (spec_text): name, type, judge route, temperature, max tokens, scope, runs on, sampling, filter, idle override, tracing, output, pass criteria, model reasoning, images, daily cost ceiling, variables, then the system prompt, the examples and the user prompt. Requires evals:read.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required | Evaluator ID |
| `version` | path | integer, required, min 1 | Version number |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | The version | `application/json`: [EvaluatorVersion](/docs/api/schemas/e/#evaluatorversion) |
| `400` | invalid_request: version is a positive integer | — |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | evaluators disabled or not in the team's plan (feature_disabled), or an evaluator outside the session's teams and organization (not_found) | — |


## GET /api/v1/admin/evals/evaluators/{id}/compare

`GET /api/v1/admin/evals/evaluators/{id}/compare` · operation `compareEvalEvaluatorVersions`

Evaluators (T186.008). Two versions side by side: diff is the line difference of their readable specs (op equal, delete for a line only in a, insert for a line only in b) and each side carries stats over [from, to) (from the older version's creation, at most 365 days back): results (judged), pass, fail, errors, skipped, pass_rate (pass/(pass+fail)), and, for a reader who sees costs (usage_valuation and analytics:read), cost (the ledger cost of the version's own judge requests: state, known_usd, requests), cost_per_result_usd, input_tokens, output_tokens and avg_tokens per judged result. Results of experiments are left out. The cost counts the runs made as an evaluator (request IDs evaluator.&lt;id&gt;.v&lt;version&gt;...); runs made through a rule before evaluators name no version. Requires evals:read.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required | Evaluator ID |
| `a` | query | integer, required, min 1 | First version |
| `b` | query | integer, required, min 1 | Second version |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | — |
| `400` | invalid_request: a and b are positive integers | — |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | evaluators disabled or not in the team's plan (feature_disabled), or an evaluator outside the session's teams and organization (not_found) | — |


## POST /api/v1/admin/evals/evaluators/{id}/publish

`POST /api/v1/admin/evals/evaluators/{id}/publish` · operation `publishEvalEvaluator`

Evaluators (T186.008). Makes a version the one live traffic runs and activates the evaluator; version omitted publishes the latest. Until then a save is a draft and live traffic keeps the published version. A publish never runs on past traffic (use the backfill). Audited (eval.evaluator.publish, and an event of the evaluator with the versions before and after). Requires evaluators:publish.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required | Evaluator ID |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object
  - `version` (integer, min 1) — The version to publish; the latest when omitted

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | The evaluator, active | `application/json`: [EvaluatorRecord](/docs/api/schemas/e/#evaluatorrecord) |
| `400` | invalid_evaluator: the version cannot run (its judge route is gone, its filter no longer parses) | — |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | evaluators disabled or not in the team's plan (feature_disabled), or an evaluator outside the session's teams and organization (not_found) | — |
| `409` | managed_by_configuration; evaluator_in_use (T186.015): a version a judge guardrail could not run (a decision model, JavaScript, no pass criteria) while one depends on the evaluator | — |
| `422` | filter_required: an evaluator that calls a model needs a filter before it is published; ceiling_needs_price: a daily cost ceiling on a judge route that has no price | — |


## POST /api/v1/admin/evals/evaluators/{id}/restore/{version}

`POST /api/v1/admin/evals/evaluators/{id}/restore/{version}` · operation `restoreEvalEvaluatorVersion`

Evaluators (T186.008). Writes the definition of an older version as a new version (source restore, restored_from). Nothing is published by it: publish the new version to put it on live traffic. Requires evals:manage.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required | Evaluator ID |
| `version` | path | integer, required, min 1 | Version number |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Responses**

| Status | Description | Body |
|---|---|---|
| `201` | The evaluator at its new version | `application/json`: [EvaluatorRecord](/docs/api/schemas/e/#evaluatorrecord) |
| `400` | invalid_evaluator: the old definition is no longer valid here | — |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | evaluators disabled or not in the team's plan (feature_disabled), or an evaluator outside the session's teams and organization (not_found) | — |
| `409` | duplicate_name or managed_by_configuration | — |


## POST /api/v1/admin/evals/evaluators/{id}/status

`POST /api/v1/admin/evals/evaluators/{id}/status` · operation `setEvalEvaluatorStatus`

Evaluators (T186.008). Pauses (paused, with an optional reason), resumes (active; needs a published version) or disables (disabled) an evaluator. A paused or disabled evaluator queues no run and its pending runs end without a result; results stay. No version is created. Audited. Requires evaluators:publish.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required | Evaluator ID |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object
  - `status` (string, required, one of `"active"`, `"paused"`, `"disabled"`)
  - `reason` (string, max length 300)

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | The evaluator | `application/json`: [EvaluatorRecord](/docs/api/schemas/e/#evaluatorrecord) |
| `400` | invalid_request | — |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | evaluators disabled or not in the team's plan (feature_disabled), or an evaluator outside the session's teams and organization (not_found) | — |
| `409` | not_published (activate without a published version) or managed_by_configuration; evaluator_in_use (T186.015): disabling an evaluator an enabled judge guardrail runs | — |


## GET /api/v1/admin/evals/evaluators/{id}/preview

`GET /api/v1/admin/evals/evaluators/{id}/preview` · operation `previewEvalEvaluator`

Evaluators (T186.008). What the evaluator's filter selects on real traffic and what running it costs: matches over the last 24 hours and 7 days (spans, traces or sessions, by scope; sessions are the distinct sessions of the newest 1,000 matching traces, truncated says more matched), sampled_weekly (the 7-day matches times sample_rate), captured_7d (span scope: the matching spans with content captured for evaluation), the newest targets (up to 10), matching_query with query_scope (the same query on GET /traces lists the same rows), warnings, and, for a reader who sees costs, cost: basis measured (the evaluator's own judge calls of the last 7 days, at least 5), estimated (the judge route's price, the prompt's size and the mean tokens of the matching targets), none (a rule) or unknown (the route has no price), with per_run_usd, weekly_usd and the tokens per run. version previews an older version. The targets are listed for a reader with logs:read (empty otherwise), and a filter on a cost field needs analytics:read (400). Requires evals:read.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required | Evaluator ID |
| `version` | query | integer, min 1 | Preview this version instead of the latest |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | The preview | `application/json`: [EvaluatorPreview](/docs/api/schemas/e/#evaluatorpreview) |
| `400` | invalid_evaluator or invalid_query | — |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | evaluators disabled or not in the team's plan (feature_disabled), or an evaluator outside the session's teams and organization (not_found) | — |


## POST /api/v1/admin/evals/evaluators/{id}/test

`POST /api/v1/admin/evals/evaluators/{id}/test` · operation `testEvalEvaluatorOnTraffic`

Evaluators (T186.008). Runs the judge on real traffic before anything is published. mode auto takes the n newest targets the filter selects in the last 7 days (1 to evaluation.test_max_targets, default 10) and answers rows with pass_rate, counts (pass, fail, none, error, skipped) and categories; mode manual takes one target (trace_id and span_id for a span evaluator, trace_id for a trace one, session_id for a session one), optional variables (a value typed for a variable name or path, replacing the resolved one) and dry_run (resolve the variables, call no judge). evaluator carries the editor's unsaved definition; with the path id draft it is a definition that is not saved yet (team_id required). Each row has the target, status and status_reason as a live run's result would have them, value, string_value, assessment, latency_ms, judge_request_id, judge_trace_id and cost_usd; the explanation, the raw judge answer, the input and output previews and the resolved variables are content, shown to a reader of the team's captured content (content_sent:read; each read is audited) and absent otherwise (content_shown). A test is origin=playground traffic of the team, costed in the ledger; nothing is stored as a result. Testing an evaluator that reads the model's reasoning (include_reasoning) or images (multimodal) by a reader of content without content_reasoning:read or content_media:read answers 403 content_read_forbidden. A code evaluator's row (T186.009) adds data (what evaluate(data) read), logs (its console output) and metadata, content shown to a content reader only and never stored; a decision model's adds value_json (its probabilities). Requires evaluators:test.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required | Evaluator ID |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object
  - `mode` (string, required, one of `"auto"`, `"manual"`)
  - `n` (integer, min 1, max 50)
  - `evaluator` ([EvaluatorDefinition](/docs/api/schemas/e/#evaluatordefinition))
  - `target` (object)
    - `trace_id` (string, pattern `^[0-9a-f]{32}$`)
    - `span_id` (string, pattern `^[0-9a-f]{16}$`)
    - `session_id` (string, max length 256)
  - `variables` (object)
    - any other key: string
  - `dry_run` (boolean, default `false`)

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | — |
| `400` | invalid_evaluator or invalid_request | — |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | evaluators disabled or not in the team's plan (feature_disabled), or an evaluator outside the session's teams and organization (not_found) | — |


## GET /api/v1/admin/evals/evaluators/{id}/results

`GET /api/v1/admin/evals/evaluators/{id}/results` · operation `listEvalEvaluatorResults`

Evaluators (T186.008). The Results tab: over [from, to) (default the last 7 days, at most 90) the summary (results, pass, fail, errors, skipped, pass_rate), mean (numeric outputs), series (pass, fail, none, errors and skipped per hour up to 49 hours, per day beyond), categories (the 20 most frequent labels with their share), category_series (the count of each of those labels per bucket), version_markers (the first bucket each version has a result in), traces_query (the query that lists the same traces on GET /traces; empty when the name cannot be a field) and data: the results, newest first, as GET /evaluations answers them, with next_cursor. Results of experiments are left out of the figures. Requires evals:read.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required | Evaluator ID |
| `from` | query | string (date-time) | Start of the range |
| `to` | query | string (date-time) | End of the range |
| `assessment` | query | string, one of `"pass"`, `"fail"`, `"none"` | Only results with this assessment |
| `status` | query | string, one of `"ok"`, `"error"`, `"skipped"` | Only results with this status |
| `version` | query | integer, min 1 | Only results of this evaluator version |
| `limit` | query | integer, default `50`, min 1, max 200 | Rows per page |
| `cursor` | query | string | next_cursor of the previous page |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | — |
| `400` | invalid_request | — |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | evaluators disabled or not in the team's plan (feature_disabled), or an evaluator outside the session's teams and organization (not_found) | — |


## GET /api/v1/admin/evals/evaluators/{id}/health

`GET /api/v1/admin/evals/evaluators/{id}/health` · operation `getEvalEvaluatorHealth`

Evaluators (T186.008). The Health tab: health (as on the evaluators list: ok, degraded or blocked with the reason; an evaluator the worker paused by itself is blocked), by_reason (errors and skips of the last 7 days by status and reason: content_not_captured, content_truncated, judge_budget_refused, judge_refused, output_unparseable, judge_failed), jobs (runs of the last 7 days by status and outcome, not_in_scope included), events (the last 50 changes: create, save, publish, restore, pause, resume, disable, auto_pause, backfill, rule_fold, delete, each with actor, status and version before and after, and reason), and, for a reader who sees costs, judge_latency_ms, judge_requests and, with a ceiling, spent_today_usd and max_daily_cost_usd. Requires evals:read.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required | Evaluator ID |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | — |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | evaluators disabled or not in the team's plan (feature_disabled), or an evaluator outside the session's teams and organization (not_found) | — |


## GET /api/v1/admin/evals/evaluators/{id}/jobs

`GET /api/v1/admin/evals/evaluators/{id}/jobs` · operation `listEvalEvaluatorJobs`

Evaluators (T186.008). The execution log: the evaluator's runs, newest first, each with evaluator_version, scope, target, trace_id, span_id, session_id, request_id, kind (live, backfill, on_demand, experiment), status (pending, running, done, failed), outcome (ok, not_in_scope, a skip or error reason, evaluator_not_active, target_gone), attempts, due_at (when a pending run may start: the end of its idle window), created_at, finished_at, error and result_id. Finished runs are kept evaluation.job_retention_days. Requires evals:read.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required | Evaluator ID |
| `status` | query | string, one of `"pending"`, `"running"`, `"done"`, `"failed"` | Only runs in this state |
| `limit` | query | integer, default `100`, min 1, max 500 | Most runs listed, 1-500 |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | — |
| `400` | invalid_request | — |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | evaluators disabled or not in the team's plan (feature_disabled), or an evaluator outside the session's teams and organization (not_found) | — |


## POST /api/v1/admin/evals/evaluators/{id}/backfill

`POST /api/v1/admin/evals/evaluators/{id}/backfill` · operation `backfillEvalEvaluator`

Evaluators (T186.008). Runs the published version of an active evaluator over the past: the targets its filter selects in [since, until) (at most 31 days), newest first, up to limit (1-1000, default 500). Sampling is not applied; a target the version already judged is skipped. dry_run answers matched and the cost estimate and queues nothing (200); otherwise 202 with matched, queued, version and cost. Audited. Requires evaluators:publish.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required | Evaluator ID |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object
  - `since` (string (date-time), required)
  - `until` (string (date-time))
  - `limit` (integer, default `500`, min 1, max 1000)
  - `dry_run` (boolean, default `false`)

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | dry_run: matched and the cost estimate | — |
| `202` | Queued: matched, queued, version, cost | — |
| `400` | invalid_request or invalid_evaluator | — |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | evaluators disabled or not in the team's plan (feature_disabled), or an evaluator outside the session's teams and organization (not_found) | — |
| `409` | not_active: publish and activate the evaluator first | — |


## POST /api/v1/admin/evals/evaluators/{id}/run

`POST /api/v1/admin/evals/evaluators/{id}/run` · operation `runEvalEvaluator`

T186.009 (code_evaluators). Evaluate selection, a query over past traffic or a run on one trace: the published version of an active or paused evaluator on each target, as jobs of kind on_demand, whatever its live filter and sampling select. targets are trace_id (with an optional span_id) or session_id, read in the evaluator's team (another team's or a gone trace is left out); a span evaluator judges the root span of a trace, a trace evaluator the trace of a span, a session evaluator the session of a trace. query runs a query of the Traces screen (scope traces or spans, q as the reader may write it, from and to at most 92 days apart, limit) over the evaluator's team. At most evaluation.max_run_targets targets (1000 by default). A target already judged is judged again and its result replaced. dry_run answers matched and the cost estimate (200); otherwise 202 with matched, queued, version, source (selection, trace or query), the cost estimate and the run. Audited. Requires evaluators:publish and logs:read.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required | Evaluator ID |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object
  - `targets` (array of object, max items 1000)
    - `trace_id` (string, pattern `^[0-9a-f]{32}$`)
    - `span_id` (string, pattern `^[0-9a-f]{16}$`)
    - `session_id` (string, max length 128)
  - `query` (object)
    - `scope` (string, one of `"traces"`, `"spans"`, default `"traces"`)
    - `q` (string, max length 4096)
    - `from` (string (date-time))
    - `to` (string (date-time))
    - `limit` (integer, min 1, max 1000)
  - `dry_run` (boolean, default `false`)

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | dry_run: matched and the cost estimate | — |
| `202` | Queued | `application/json`: object |
| `400` | invalid_request, too_many_targets, invalid_target, invalid_query or invalid_evaluator | — |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | evaluators or code_evaluators disabled or not in the team's plan (feature_disabled), or an evaluator outside the session's teams and organization (not_found) | — |
| `409` | not_published: publish the evaluator first; a disabled evaluator does not run | — |
| `422` | no_targets: no chosen target is in the team's span store | — |

Response `202` fields:

- `application/json`: object
  - `matched` (integer)
  - `queued` (integer)
  - `version` (integer)
  - `source` (string)
  - `run` ([OnDemandRun](/docs/api/schemas/o/#ondemandrun))


## GET /api/v1/admin/evals/evaluators/{id}/runs

`GET /api/v1/admin/evals/evaluators/{id}/runs` · operation `listEvalEvaluatorRuns`

T186.009 (code_evaluators). The evaluator's on-demand runs, newest first (50), each with its progress counted from its jobs. Requires evals:read.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required | Evaluator ID |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | `application/json`: object |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | feature_disabled or not_found | — |

Response `200` fields:

- `application/json`: object
  - `data` (array of [OnDemandRun](/docs/api/schemas/o/#ondemandrun))


## GET /api/v1/admin/evals/evaluators/{id}/runs/{run}

`GET /api/v1/admin/evals/evaluators/{id}/runs/{run}` · operation `getEvalEvaluatorRun`

T186.009 (code_evaluators). One on-demand run with its progress, for polling. Requires evals:read.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required | Evaluator ID |
| `run` | path | string, required | Run ID |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | `application/json`: [OnDemandRun](/docs/api/schemas/o/#ondemandrun) |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | feature_disabled or not_found | — |


## POST /api/v1/admin/evals/evaluators/{id}/runs/{run}/cancel

`POST /api/v1/admin/evals/evaluators/{id}/runs/{run}/cancel` · operation `cancelEvalEvaluatorRun`

T186.009 (code_evaluators). Ends every job of the run that has not started (outcome cancelled); a running job finishes. Audited. Requires evaluators:publish.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required | Evaluator ID |
| `run` | path | string, required | Run ID |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | `application/json`: [OnDemandRun](/docs/api/schemas/o/#ondemandrun) |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | feature_disabled or not_found | — |
| `409` | run_finished: nothing is left to cancel | — |


## GET /api/v1/admin/evals/code-builtins

`GET /api/v1/admin/evals/code-builtins` · operation `getEvalCodeBuiltins`

T186.009 (code_evaluators). The code evaluator runtime for the editor: the signature of evaluate, what it may return, the built-ins (similarity, jsonPath, countTokensApprox, console.log) with their limits, the fields of data per scope and the effective evaluation.code limits. Requires evals:read.

**Authentication:** `adminSession`

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | — |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | evaluators or code_evaluators disabled (feature_disabled) | — |


## POST /api/v1/admin/evals/evaluators/preview

`POST /api/v1/admin/evals/evaluators/preview` · operation `previewEvalEvaluatorDraft`

Evaluators (T186.008). What a definition that is not saved yet would judge and cost, for the editor: only team_id, scope, filter, sample_rate and runs_on must be valid (the rest may still be incomplete). Answers as GET /evals/evaluators/{id}/preview. Reads only; no CSRF token. Requires evals:read and a team the session administers.

**Authentication:** `adminSession`

**Request body** (required)

- `application/json`: object
  - `evaluator` ([EvaluatorDefinition](/docs/api/schemas/e/#evaluatordefinition), required)

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | The preview | `application/json`: [EvaluatorPreview](/docs/api/schemas/e/#evaluatorpreview) |
| `400` | invalid_evaluator (scope, sampling or runs_on) or invalid_query (the filter, with the parser's message) | — |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | evaluators disabled or not in the team's plan (feature_disabled), or an evaluator outside the session's teams and organization (not_found) | — |


## GET /api/v1/admin/evals/runs

`GET /api/v1/admin/evals/runs` · operation `listEvalRuns`

Experiment runs with progress, token usage, latency and score_aggregates: per score name, avg (null for labels), count and, for a categorical score, labels with the count of each label (T186.018); dataset_id filters. With usage_valuation on and analytics:read, each run carries cost {state known|partial|unknown, known_usd (exact decimal string), requests, unvalued_requests}: the ledger valuation of the run's model calls and judge calls (request IDs eval.&lt;run&gt;.&lt;item&gt; and eval.&lt;run&gt;.&lt;item&gt;.judge.*, or the linked request of an API run). partial means some requests have no known price; unknown is never zero; absent when no request is in the ledger. Requires evals and evals:read; team roles are limited to their teams.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `team_id` | query | string | Only this team's rows. A team of the session, or for an organization administrator a team that left its organization (what it recorded there). A team the session may not name answers 403 team_forbidden. |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | — |
| `400` | Invalid input | — |
| `404` | Feature disabled or not visible | — |


## POST /api/v1/admin/evals/runs

`POST /api/v1/admin/evals/runs` · operation `createEvalRun`

name, dataset_id, model (chat alias), optional prompt_id (team prompt, published revision), optional prompt_revision (prompt_tracking, T186.013: a stored revision 1-100 of that prompt of the dataset team, published or not; 400 without prompt_id or the flag) and up to 10 evaluator_ids. With experiment_traces in the dataset team's plan (T186.012) the run is traced (traced true: each item one trace with its judges nested, run items carrying trace_id, span_id and item_version), name may be empty (it becomes the dataset's name and the UTC time), trials (1-10; with trials set, an item's metadata.trials overrides it; trials are run items &lt;item&gt;:t&lt;n&gt;), sessions (items carrying metadata.session_id, 1-64 characters, run in metadata.turn then item order as one conversation with X-Gateway-Session-Id exp-&lt;run&gt;-&lt;session&gt;), session_evaluator_ids (judges of each session; imply sessions) and, with remote_experiments, remote_endpoint_id (the team's endpoint executes the items; no prompt, no sessions; a callback endpoint's run answers run_token once, with Cache-Control no-store) (T186.012b); dry_run true answers a check instead of starting the run ({items, valid, invalid: [{item_id, error}] (at most 50 items whose input does not render with the prompt), judge_estimate as in a run evaluation}), and dataset_as_of (RFC 3339, a past instant of the dataset's version history) runs that older version (400 without the flag). The run snapshots the dataset instant, prompt revision and evaluator versions, and executes in the background through the gateway as the dataset team (principal eval:&lt;run&gt;). Optional customer {org, team, member} (T158.006, needs customer_portal and customers:manage for the dataset team) charges the model calls and the evaluator judge calls of the run to that registered, enabled customer (a judge call refused at an exhausted ceiling is not retried; model calls carry max_completion_tokens 4096); 422 customer_unknown, 403 customer_disabled or team_forbidden. Requires evals and evals:manage; team roles are limited to their teams.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object

**Responses**

| Status | Description | Body |
|---|---|---|
| `201` | Queued | — |
| `400` | Invalid input | — |
| `404` | Feature disabled or not visible | — |


## GET /api/v1/admin/evals/runs/{id}

`GET /api/v1/admin/evals/runs/{id}` · operation `getEvalRun`

Run and items with output, latency, tokens, request_id (the item's model call), error and scores. A traced run (T186.012, experiment_traces) has traced true, its suite_id when a regression suite ran it, and each item its trace_id, span_id (the item's request span: its judges are child spans) and item_version (the dataset item version it ran); task_cost and judge_cost split cost into the item calls and the judge calls on the run and each item (T186.012b, under the same visibility); score_aggregates carry passed and assessed (results assessed pass, and pass or fail) beside avg and count. With usage_valuation on and analytics:read, the run and each item carry cost (same shape as in the run list): an item's cost covers its model call and its judge calls. Requires evals and evals:read; team roles are limited to their teams.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | — |
| `400` | Invalid input | — |
| `404` | Feature disabled or not visible | — |


## POST /api/v1/admin/evals/runs/{id}/cancel

`POST /api/v1/admin/evals/runs/{id}/cancel` · operation `cancelEvalRun`

Stops a queued or running run. Requires evals and evals:manage; team roles are limited to their teams.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Responses**

| Status | Description | Body |
|---|---|---|
| `204` | Canceled | — |
| `400` | Invalid input | — |
| `404` | Feature disabled or not visible | — |


## GET /api/v1/admin/evals/runs/{id}/compare/{base}

`GET /api/v1/admin/evals/runs/{id}/compare/{base}` · operation `compareEvalRuns`

Per score name, items improved, regressed, unchanged or changed against a baseline run on the same dataset. Requires evals and evals:read; team roles are limited to their teams.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |
| `base` | path | string, required |  |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | — |
| `400` | Invalid input | — |
| `404` | Feature disabled or not visible | — |


## GET /api/v1/admin/topics/settings

`GET /api/v1/admin/topics/settings` · operation `getTopicSettings`

Topics settings as the gateway applies them (T186.020). Requires topics and topics:read; under plan entitlements the team plan must include topics. A team-scoped role sees the maps of its teams and, for an organization admin, of its organization; a missing and a foreign object answer the same 404. Every field of the topics block with its default filled in, the block as configured, the YAML block, the source (yaml or api), the version an editor sends back, and the embedding lock.

**Authentication:** `adminSession`

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | `application/json`: [TopicsSettings](/docs/api/schemas/t/#topicssettings) |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | A role without topics:read, or entitlement_forbidden | — |
| `404` | feature_disabled | — |


## PUT /api/v1/admin/topics/settings

`PUT /api/v1/admin/topics/settings` · operation `putTopicSettings`

Replace the whole topics block at run time; it takes effect within one worker tick, with no restart. Requires topics and topics:configure, which only the gateway administrator holds. The embedding model and its dimensions may not change while embedded summaries exist (409 embedding_locked): reset first.

**Authentication:** `adminSession`

**Request body** (required)

- `application/json`: [TopicsSettingsWrite](/docs/api/schemas/t/#topicssettingswrite)

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | `application/json`: [TopicsSettingsVersion](/docs/api/schemas/t/#topicssettingsversion) |
| `400` | invalid_topics_settings: a value outside its bounds, an unknown field, a model alias that names no model | — |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | A role without topics:configure | — |
| `404` | feature_disabled | — |
| `409` | version_conflict or embedding_locked | — |


## DELETE /api/v1/admin/topics/settings

`DELETE /api/v1/admin/topics/settings` · operation `revertTopicSettings`

Remove the stored block: the YAML block is in force again. Requires topics and topics:configure, which only the gateway administrator holds.

**Authentication:** `adminSession`

**Request body** (required)

- `application/json`: [TopicsSettingsRevert](/docs/api/schemas/t/#topicssettingsrevert)

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | `application/json`: [TopicsSettingsVersion](/docs/api/schemas/t/#topicssettingsversion) |
| `400` | invalid_topics_settings | — |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | A role without topics:configure | — |
| `404` | feature_disabled, or not_found when nothing is stored | — |
| `409` | version_conflict or embedding_locked | — |


## POST /api/v1/admin/topics/reset

`POST /api/v1/admin/topics/reset` · operation `resetTopics`

Delete every stored summary, topic and assignment of every team and ask each live map for a new setup: the explicit step that unlocks the embedding model. Maps, facets and settings stay. Requires topics and topics:configure, which only the gateway administrator holds.

**Authentication:** `adminSession`

**Request body** (required)

- `application/json`: [TopicsReset](/docs/api/schemas/t/#topicsreset)

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | `application/json`: [TopicsResetResult](/docs/api/schemas/t/#topicsresetresult) |
| `400` | confirmation_required | — |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | A role without topics:configure | — |
| `404` | feature_disabled | — |


## GET /api/v1/admin/topics/facets

`GET /api/v1/admin/topics/facets` · operation `listTopicFacets`

The facets: the built-ins (Intent, Sentiment, Outcome, Issues, and Signals with no model) with their prompts and labels, and with topics_custom_facets the reader's teams' own. Requires topics and topics:read; under plan entitlements the team plan must include topics. A team-scoped role sees the maps of its teams and, for an organization admin, of its organization; a missing and a foreign object answer the same 404.

**Authentication:** `adminSession`

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | `application/json`: [TopicFacetList](/docs/api/schemas/t/#topicfacetlist) |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | A role without topics:read | — |
| `404` | feature_disabled | — |


## PUT /api/v1/admin/topics/facets/{key}

`PUT /api/v1/admin/topics/facets/{key}` · operation `putTopicFacet`

Create a team's own facet or write a new version of it; a changed prompt or label list raises the version, so older summaries are never mixed with the new wording. Requires topics_custom_facets and topics:manage of the team.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `key` | path | string, required, min length 1, max length 128 | Facet key: 2 to 32 lowercase letters, digits or underscores, starting with a letter; not a built-in key |

**Request body** (required)

- `application/json`: [TopicFacetWrite](/docs/api/schemas/t/#topicfacetwrite)

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | `application/json`: [TopicFacet](/docs/api/schemas/t/#topicfacet) |
| `400` | invalid_request | — |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | team_forbidden or a role without topics:manage | — |
| `404` | feature_disabled (topics or topics_custom_facets is off) | — |
| `409` | builtin_facet or limit_reached (20 facets per team) | — |


## DELETE /api/v1/admin/topics/facets/{key}

`DELETE /api/v1/admin/topics/facets/{key}` · operation `deleteTopicFacet`

Delete a team's own facet. A map that still names it keeps its published topics and summarises nothing more for it.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `key` | path | string, required, min length 1, max length 128 | Facet key |
| `team` | query | string, required, max length 256 | The facet's team |

**Responses**

| Status | Description | Body |
|---|---|---|
| `204` | Deleted | — |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | A role without topics:manage | — |
| `404` | feature_disabled (topics is off) or not_found | — |


## GET /api/v1/admin/topics/maps

`GET /api/v1/admin/topics/maps` · operation `listTopicMaps`

The maps the reader sees: live maps of production traffic and snapshots of one slice. Requires topics and topics:read; under plan entitlements the team plan must include topics. A team-scoped role sees the maps of its teams and, for an organization admin, of its organization; a missing and a foreign object answer the same 404.

**Authentication:** `adminSession`

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | `application/json`: [TopicMapList](/docs/api/schemas/t/#topicmaplist) |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | A role without topics:read | — |
| `404` | feature_disabled | — |


## POST /api/v1/admin/topics/maps

`POST /api/v1/admin/topics/maps` · operation `createTopicMap`

Create a live map or a snapshot. Requires topics and topics:manage of the map's team (or, for an organization's map, an administrator of that organization). A live map summarises its newest units at once (setup_backfill) and is fitted when nine in ten of them settled; a snapshot is fitted once over its window and frozen. A map with a model facet needs topics.summary_model and topics.embedding_model.

**Authentication:** `adminSession`

**Request body** (required)

- `application/json`: [TopicMapCreate](/docs/api/schemas/t/#topicmapcreate)

**Responses**

| Status | Description | Body |
|---|---|---|
| `201` | Created | `application/json`: [TopicMap](/docs/api/schemas/t/#topicmap) |
| `400` | invalid_request or invalid_query (the filter) | — |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | team_forbidden or organization_forbidden | — |
| `404` | feature_disabled | — |
| `409` | duplicate (a map of that name), limit_reached (max_maps_per_team) or models_not_configured | — |


## POST /api/v1/admin/topics/maps/estimate

`POST /api/v1/admin/topics/maps/estimate` · operation `estimateTopicMap`

What a map would spend, with no model call and no content read: the matching units of the window, the tokens per unit from the gateway's own figures of a sample of 50 matching traces, and the cost when the summary model has a manual price. Requires topics and topics:manage of the map's team (or, for an organization's map, an administrator of that organization).

**Authentication:** `adminSession`

**Request body** (required)

- `application/json`: [TopicMapCreate](/docs/api/schemas/t/#topicmapcreate)

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | `application/json`: [TopicMapEstimate](/docs/api/schemas/t/#topicmapestimate) |
| `400` | invalid_request or invalid_query | — |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | team_forbidden | — |
| `404` | feature_disabled | — |


## GET /api/v1/admin/topics/maps/{id}

`GET /api/v1/admin/topics/maps/{id}` · operation `readTopicMap`

One map with its unit counts by state and reason, its assignments per facet and, for a reader who sees costs, what its own model calls cost from the ledger. Requires topics and topics:read; under plan entitlements the team plan must include topics. A team-scoped role sees the maps of its teams and, for an organization admin, of its organization; a missing and a foreign object answer the same 404.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required, min length 1, max length 128 | Map ID |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | `application/json`: [TopicMap](/docs/api/schemas/t/#topicmap) |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | A role without topics:read | — |
| `404` | feature_disabled (topics is off) or not_found | — |


## DELETE /api/v1/admin/topics/maps/{id}

`DELETE /api/v1/admin/topics/maps/{id}` · operation `deleteTopicMap`

Delete a map with its units, runs, topics and assignments. Summaries stay: they belong to the team's units, are reused by its other maps and expire on their own. Requires topics and topics:manage of the map's team (or, for an organization's map, an administrator of that organization).

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required, min length 1, max length 128 | Map ID |

**Responses**

| Status | Description | Body |
|---|---|---|
| `204` | Deleted | — |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | A role without topics:manage | — |
| `404` | feature_disabled (topics is off) or not_found | — |


## PATCH /api/v1/admin/topics/maps/{id}

`PATCH /api/v1/admin/topics/maps/{id}` · operation `updateTopicMap`

Change a map's name, filter, sample rate, facets, per-map budget or state (paused, or active to resume: the explicit action that clears a budget or provider pause). A snapshot takes a new name or budget only. Requires topics and topics:manage of the map's team (or, for an organization's map, an administrator of that organization).

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required, min length 1, max length 128 | Map ID |

**Request body** (required)

- `application/json`: [TopicMapPatch](/docs/api/schemas/t/#topicmappatch)

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | `application/json`: [TopicMap](/docs/api/schemas/t/#topicmap) |
| `400` | invalid_request or invalid_query | — |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | A role without topics:manage | — |
| `404` | feature_disabled (topics is off) or not_found | — |
| `409` | duplicate or invalid_state | — |


## POST /api/v1/admin/topics/maps/{id}/refresh

`POST /api/v1/admin/topics/maps/{id}/refresh` · operation `refreshTopicMap`

Fit a live map again now, at most once per refresh_cooldown. Requires topics and topics:manage of the map's team (or, for an organization's map, an administrator of that organization).

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required, min length 1, max length 128 | Map ID |

**Responses**

| Status | Description | Body |
|---|---|---|
| `202` | The fit was asked | `application/json`: [TopicMap](/docs/api/schemas/t/#topicmap) |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | A role without topics:manage | — |
| `404` | feature_disabled (topics is off) or not_found | — |
| `409` | invalid_state (a snapshot, or a map that is not active) | — |
| `429` | refresh_cooldown | — |


## GET /api/v1/admin/topics/maps/{id}/runs

`GET /api/v1/admin/topics/maps/{id}/runs` · operation `listTopicRuns`

The fits of a map, newest first, each with what it did per facet (cohort, topics, new and retired topics, outliers, whether the cohort was truncated or fitted in small-sample mode, or why the facet was skipped). Requires topics and topics:read; under plan entitlements the team plan must include topics. A team-scoped role sees the maps of its teams and, for an organization admin, of its organization; a missing and a foreign object answer the same 404.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required, min length 1, max length 128 | Map ID |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | `application/json`: [TopicRunList](/docs/api/schemas/t/#topicrunlist) |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | A role without topics:read | — |
| `404` | feature_disabled (topics is off) or not_found | — |


## GET /api/v1/admin/topics/maps/{id}/topics

`GET /api/v1/admin/topics/maps/{id}/topics` · operation `listTopics`

The topics of one facet of a map with their figures in a window and in the window of the same length before it: units and share, spend, p50 and p95 duration, traces in error, tokens, evaluation results and pass rate. Spend follows the request log's rule (usage_valuation and analytics:read). Requires topics and topics:read; under plan entitlements the team plan must include topics. A team-scoped role sees the maps of its teams and, for an organization admin, of its organization; a missing and a foreign object answer the same 404.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required, min length 1, max length 128 | Map ID |
| `facet` | query | string, max length 256 | A facet of the map; default its first |
| `from` | query | string (date-time) | Default: 7 days before to; a snapshot defaults to its own window |
| `to` | query | string (date-time) | At most 93 days after from |
| `retired` | query | string, one of `"true"`, `"false"` | true adds the topics a refit left without a successor |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | `application/json`: [TopicList](/docs/api/schemas/t/#topiclist) |
| `400` | invalid_request | — |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | A role without topics:read | — |
| `404` | feature_disabled (topics is off) or not_found | — |


## GET /api/v1/admin/topics/maps/{id}/points

`GET /api/v1/admin/topics/maps/{id}/points` · operation `listTopicPoints`

The scatter of a facet: the units the last fit placed, with coordinates in [-1, 1] (the first two principal components of the cohort) and their topic; at most 5000, the newest. No text. Units assigned since the fit have no point until the next one. Requires topics and topics:read; under plan entitlements the team plan must include topics. A team-scoped role sees the maps of its teams and, for an organization admin, of its organization; a missing and a foreign object answer the same 404.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required, min length 1, max length 128 | Map ID |
| `facet` | query | string, required, max length 64 | A facet of the map |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | `application/json`: [TopicPoints](/docs/api/schemas/t/#topicpoints) |
| `400` | invalid_request | — |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | A role without topics:read | — |
| `404` | feature_disabled (topics is off) or not_found | — |


## GET /api/v1/admin/topics/summaries

`GET /api/v1/admin/topics/summaries` · operation `listTopicSummaries`

The facet summaries of a map's units, newest first, with each unit's assignment: all, those of one topic, or the outliers. The summary text is returned only for the teams of which the reader holds content_sent:read; otherwise the row carries content_hidden true and no text. Requires topics and topics:read; under plan entitlements the team plan must include topics. A team-scoped role sees the maps of its teams and, for an organization admin, of its organization; a missing and a foreign object answer the same 404.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `map` | query | string, required, max length 128 | Map ID |
| `facet` | query | string, required, max length 64 | A facet of the map |
| `topic` | query | string, max length 256 | Only this topic |
| `assignment` | query | string, one of `"outlier"` | outlier: only units assigned to no topic |
| `limit` | query | integer, default `50`, min 1, max 200 | Rows per page |
| `cursor` | query | string | next_cursor of the page before |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | `application/json`: [TopicSummaryPage](/docs/api/schemas/t/#topicsummarypage) |
| `400` | invalid_request | — |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | A role without topics:read | — |
| `404` | feature_disabled (topics is off) or not_found | — |


## GET /api/v1/admin/topics/assignments

`GET /api/v1/admin/topics/assignments` · operation `listTopicAssignments`

The units of a map with the topic each was assigned, the distance to its centroid and whether a fit (initial) or the live assignment (online) placed it. No text. Requires topics and topics:read; under plan entitlements the team plan must include topics. A team-scoped role sees the maps of its teams and, for an organization admin, of its organization; a missing and a foreign object answer the same 404.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `map` | query | string, required, max length 128 | Map ID |
| `facet` | query | string, max length 64 | A facet of the map; default every facet |
| `topic` | query | string, max length 256 | Only this topic |
| `assignment` | query | string, one of `"outlier"` | outlier: only units assigned to no topic |
| `limit` | query | integer, default `100`, min 1, max 1000 | Rows per page |
| `cursor` | query | string | next_cursor of the page before |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | `application/json`: [TopicAssignmentPage](/docs/api/schemas/t/#topicassignmentpage) |
| `400` | invalid_request | — |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | A role without topics:read | — |
| `404` | feature_disabled (topics is off) or not_found | — |


## GET /api/v1/admin/topics/units

`GET /api/v1/admin/topics/units` · operation `readUnitTopics`

A unit's topics in the live maps the reader sees: what the trace and session screens show as chips. A team outside the reader's answers an empty list. Requires topics and topics:read; under plan entitlements the team plan must include topics. A team-scoped role sees the maps of its teams and, for an organization admin, of its organization; a missing and a foreign object answer the same 404.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `team` | query | string, required, max length 256 | The unit's team |
| `unit` | query | string, required, max length 256 | A trace ID, or a session or run ID |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | `application/json`: [UnitTopicList](/docs/api/schemas/u/#unittopiclist) |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | A role without topics:read | — |
| `404` | feature_disabled | — |


## GET /api/v1/admin/topics/findings

`GET /api/v1/admin/topics/findings` · operation `listTopicFindingKinds`

The finding kinds and their thresholds (topics_findings). Findings themselves are alerts with source topics or insights: GET /api/v1/admin/alerts?source=topics. Requires topics or topics_findings and topics:read.

**Authentication:** `adminSession`

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | `application/json`: [TopicFindingKinds](/docs/api/schemas/t/#topicfindingkinds) |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | A role without topics:read | — |
| `404` | feature_disabled | — |


## GET /api/v1/admin/topics/{id}

`GET /api/v1/admin/topics/{id}` · operation `readTopic`

One topic: its figures in the window and the one before, the trend per day, its representative summaries (text under the content rule), its parent and children, and its model deployments (requests, cost and p95 per model alias and provider inside the topic). query is the explorer term that selects its units. Requires topics and topics:read; under plan entitlements the team plan must include topics. A team-scoped role sees the maps of its teams and, for an organization admin, of its organization; a missing and a foreign object answer the same 404.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required, min length 1, max length 128 | Topic ID |
| `from` | query | string (date-time) | Default: 7 days before to |
| `to` | query | string (date-time) | At most 93 days after from |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | `application/json`: [TopicDetail](/docs/api/schemas/t/#topicdetail) |
| `400` | invalid_request | — |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | A role without topics:read | — |
| `404` | feature_disabled (topics is off) or not_found | — |


## PATCH /api/v1/admin/topics/{id}

`PATCH /api/v1/admin/topics/{id}` · operation `updateTopic`

Rename, describe, pin or mute a topic. A name a person gives is pinned: no refit rewrites it. A label's topic keeps its label as its name. Requires topics and topics:manage of the map's team (or, for an organization's map, an administrator of that organization).

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required, min length 1, max length 128 | Topic ID |

**Request body** (required)

- `application/json`: [TopicPatch](/docs/api/schemas/t/#topicpatch)

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | `application/json`: [Topic](/docs/api/schemas/t/#topic) |
| `400` | invalid_request | — |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | A role without topics:manage | — |
| `404` | feature_disabled (topics is off) or not_found | — |
| `409` | duplicate (another topic of the facet has that name) or invalid_state | — |


## POST /api/v1/admin/topics/{id}/merge

`POST /api/v1/admin/topics/{id}/merge` · operation `mergeTopic`

Move the units of this topic into another topic of the same map and facet and retire this one. Requires topics and topics:manage of the map's team (or, for an organization's map, an administrator of that organization).

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required, min length 1, max length 128 | The topic that is retired |

**Request body** (required)

- `application/json`: [TopicMerge](/docs/api/schemas/t/#topicmerge)

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | `application/json`: [Topic](/docs/api/schemas/t/#topic) |
| `400` | invalid_request | — |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | A role without topics:manage | — |
| `404` | feature_disabled (topics is off) or not_found | — |
| `409` | invalid_state (another map or facet, the same topic, or a label's topic) | — |


## POST /api/v1/admin/topics/{id}/dataset

`POST /api/v1/admin/topics/{id}/dataset` · operation `topicToDataset`

Add the captured requests of a topic's newest units to a dataset, through the dataset's own import: evals:manage, the write right on the dataset, content_sent:read of the team and the audit of the read are that route's. Units with no capture the importer can read are left out and counted in the X-Topic-Units-Skipped header.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required, min length 1, max length 128 | Topic ID |

**Request body** (required)

- `application/json`: [TopicToDataset](/docs/api/schemas/t/#topictodataset)

**Responses**

| Status | Description | Body |
|---|---|---|
| `201` | Items added, as POST /evals/datasets/{id}/items/from-captures answers | — |
| `400` | invalid_request | — |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | content_read_forbidden, team_forbidden or a role without evals:manage | — |
| `404` | feature_disabled (topics is off) or not_found | — |
| `409` | no_captured_units, capture_team_mismatch or capture_unreadable | — |


## POST /api/v1/admin/topics/{id}/evaluator

`POST /api/v1/admin/topics/{id}/evaluator` · operation `draftTopicEvaluator`

An evaluator a person can save, written from a topic: a judge prompt that carries the topic's description and, for a reader who may read them, its representative summaries, and the rule filter that targets the topic. Nothing is stored. Requires evals:manage and topics:read.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required, min length 1, max length 128 | Topic ID |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | `application/json`: [TopicEvaluatorDraft](/docs/api/schemas/t/#topicevaluatordraft) |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | A role without evals:manage | — |
| `404` | feature_disabled (topics is off) or not_found | — |


## POST /api/v1/admin/topics/mcp

`POST /api/v1/admin/topics/mcp` · operation `topicsMCP`

The admin MCP server of Topics: Model Context Protocol over Streamable HTTP in its stateless form (one JSON-RPC 2.0 request, one JSON response). Methods initialize, ping, tools/list and tools/call; the tools are list_topic_facets, list_topic_maps, list_topics, get_topic, list_topic_summaries and list_topic_assignments, all reads. A tool call runs the admin read of the same name as the caller (a console session, or the admin API Bearer token with admin.token_bearer): the same permission, team and organization scope and content rule. Requires topics and topics:read; under plan entitlements the team plan must include topics. A team-scoped role sees the maps of its teams and, for an organization admin, of its organization; a missing and a foreign object answer the same 404.

**Authentication:** `adminSession`

**Request body** (required)

- `application/json`: [MCPRequest](/docs/api/schemas/m/#mcprequest)

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | OK | `application/json`: [MCPResponse](/docs/api/schemas/m/#mcpresponse) |
| `202` | A notification was accepted | — |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | A role without topics:read | — |
| `404` | feature_disabled | — |


## GET /api/v1/admin/evaluation/settings

`GET /api/v1/admin/evaluation/settings` · operation `getEvaluationSettings`

The effective evaluation block of the configuration file, with the source of each value (configuration or default): the evaluator runtime of evaluators (T186.008: the idle windows of trace and session evaluators, the delay of span evaluators, the worker's concurrency and the bounds of the test pane, of a prompt variable and of the execution log; durations also in seconds), the label bounds of the evaluation series (evaluation.metrics) and the monitor scheduler's settings (evaluation.monitors) with the monitors declared in YAML that the session may see (T186.010). The block is set in YAML and read at startup (applies: restart); this endpoint and the console show it and do not change it. An evaluator overrides the two idle windows for itself. features says which of evaluators, evaluation_metrics and evaluation_monitors are on. Requires one of them, and config:read.

**Authentication:** `adminSession`

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Effective settings | `application/json`: [EvaluationSettings](/docs/api/schemas/e/#evaluationsettings) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | Feature disabled | `application/json`: [Error](/docs/api/schemas/e/#error) |


## POST /v1/sessions/{id}/close

`POST /v1/sessions/{id}/close` · operation `closeSession`

T186.011 (session_explorer and evaluators; both in the team's plan under feature_plan_entitlements). Requires key scope scores:write. Tells the gateway that a session of the key's team has ended: its session-scope evaluator runs still waiting for evaluation.session_idle become due now (live runs only, in the team's current organization). A later request of the same session pushes the runs back by the idle window as before. Answers how many runs moved; a session with no waiting run answers 0.

**Authentication:** `bearerAuth`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required, min length 1, max length 128 |  |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | The runs made due | `application/json`: object |
| `400` | invalid_session_id | — |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | scope_forbidden or team_required | — |
| `404` | feature_disabled | — |
| `503` | storage_unavailable or entitlement_unavailable | — |

Response `200` fields:

- `application/json`: object
  - `session_id` (string, required)
  - `runs_due` (integer, required, min 0)


## POST /v1/scores

`POST /v1/scores` · operation `createScore`

Requires evals and key scope scores:write. Feedback on a request_id or session of the key team, or on a run item (target id "&lt;run_id&gt;/&lt;item_id&gt;", the score_target of a linked item) of a run of that team, validated now against the score config with that name (type, range, categories) or the given data_type. The same id replays as an update, never a duplicate. With evaluation_results (T186.003; the team plan must include it under feature_plan_entitlements) the body may also name a span (span_id with trace_id, lowercase W3C hex as the gateway returns them), a trace (trace_id), a session (session_id), a request (request_id), or every request that carried X-Gateway-Feedback-Key with that value (join_key; the 100 newest of the key's team and organization, one result each, answered as {"data":[...]} when several; requests tagged with the usage tag feedback_key as a compatibility fallback), exactly one target; and carry metric_type (json values up to 8 KiB), assessment, status ok/error/skipped with status_reason and error, source api or feedback (feedback needs submitter), evaluator_id, evaluator_version and reasoning (stored encrypted, never echoed). {"scores": [...]} sends up to 1000 results, validated whole before any is stored (400 names the item). With the flag off a v2 field is refused as an unknown field.

**Authentication:** `bearerAuth`

**Request body** (required)

- `application/json`: [EvaluationResultInput](/docs/api/schemas/e/#evaluationresultinput) or object
  - One of (1): [EvaluationResultInput](/docs/api/schemas/e/#evaluationresultinput)
  - One of (2): object
    - `scores` (array of [EvaluationResultInput](/docs/api/schemas/e/#evaluationresultinput), required, min items 1, max items 1000)

**Responses**

| Status | Description | Body |
|---|---|---|
| `201` | Stored; a batch answers {"data":[...]} in the order sent | `application/json`: [EvaluationResult](/docs/api/schemas/e/#evaluationresult) or object |
| `400` | invalid_score with the reason, batch_too_large, invalid_request | — |
| `403` | scope_forbidden, team_required, team_forbidden or entitlement_forbidden | — |
| `404` | Feature disabled | — |
| `409` | duplicate (an id of another team, target or name) | — |
| `503` | analytics_store_unavailable (results in the analytics store) or storage_unavailable | — |

Response `201` fields:

- `application/json`: [EvaluationResult](/docs/api/schemas/e/#evaluationresult) or object
  - One of (1): [EvaluationResult](/docs/api/schemas/e/#evaluationresult)
  - One of (2): object
    - `data` (array of [EvaluationResult](/docs/api/schemas/e/#evaluationresult))


## List the datasets of the key team

`GET /v1/datasets` · operation `listPublicDatasets`

Requires evals_public_api (with evals) and key scope evals:read; the key must belong to a team and sees only that team's datasets, newest first (ADR 0127). Page-based pagination: page and limit.

**Authentication:** `bearerAuth`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `page` | query | integer, default `1`, min 1, max 100000 |  |
| `limit` | query | integer, default `50`, min 1, max 100 |  |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | One page | `application/json`: object |
| `400` | page or limit out of range | — |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | scope_forbidden or team_required | — |
| `404` | Feature disabled | — |

Response `200` fields:

- `application/json`: object
  - `data` (array of [EvalDataset](/docs/api/schemas/e/#evaldataset))
  - `meta` ([EvalPageMeta](/docs/api/schemas/e/#evalpagemeta))


## Read a dataset of the key team by name

`GET /v1/datasets/{name}` · operation `getPublicDataset`

Requires evals_public_api and evals:read. The name is resolved within the key team only (percent-encode slashes and spaces); a dataset of another team answers 404, like a missing one.

**Authentication:** `bearerAuth`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `name` | path | string, required, max length 120 | Dataset name within the key team |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Dataset | `application/json`: [EvalDataset](/docs/api/schemas/e/#evaldataset) |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | scope_forbidden or team_required | — |
| `404` | Feature disabled, or no dataset with this name in the key team | — |


## Page the items of a dataset at one instant

`GET /v1/datasets/{name}/items` · operation `listPublicDatasetItems`

Requires evals_public_api and evals:read. Items valid at as_of (default: the database now), ordered by ID. The response returns that as_of: pass it to the next pages to read one version of the dataset even if it is edited meanwhile.

**Authentication:** `bearerAuth`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `name` | path | string, required, max length 120 | Dataset name within the key team |
| `as_of` | query | string (date-time) | RFC 3339 instant |
| `page` | query | integer, default `1`, min 1, max 100000 |  |
| `limit` | query | integer, default `50`, min 1, max 100 |  |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | One page | `application/json`: object |
| `400` | Invalid as_of, page or limit | — |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | scope_forbidden or team_required | — |
| `404` | Feature disabled, or no dataset with this name in the key team | — |

Response `200` fields:

- `application/json`: object
  - `data` (array of [EvalDatasetItem](/docs/api/schemas/e/#evaldatasetitem))
  - `meta` ([EvalPageMeta](/docs/api/schemas/e/#evalpagemeta))
  - `as_of` (string (date-time))


## List the runs of a dataset

`GET /v1/datasets/{name}/runs` · operation `listPublicDatasetRuns`

Requires evals_public_api and evals:read. Runs of both origins (console runner and API), newest first. The view omits the evaluator snapshot and who created the run.

**Authentication:** `bearerAuth`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `name` | path | string, required, max length 120 | Dataset name within the key team |
| `page` | query | integer, default `1`, min 1, max 100000 |  |
| `limit` | query | integer, default `50`, min 1, max 100 |  |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | One page | `application/json`: object |
| `400` | page or limit out of range | — |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | scope_forbidden or team_required | — |
| `404` | Feature disabled, or no dataset with this name in the key team | — |

Response `200` fields:

- `application/json`: object
  - `data` (array of [PublicEvalRun](/docs/api/schemas/p/#publicevalrun))
  - `meta` ([EvalPageMeta](/docs/api/schemas/e/#evalpagemeta))


## Read a run with its items and scores

`GET /v1/datasets/{name}/runs/{run}` · operation `getPublicDatasetRun`

Requires evals_public_api and evals:read. {run} is a run ID or a name only one run of the dataset has (API run names are unique; console run names may repeat, which answers 409 ambiguous_name). Items are paged; each carries its scores without their creator. fields (T186.016) takes core and evaluations (the default: items with their scores), cost (with usage_valuation: the ledger cost of the run, as cost, and of each item) and trace (each item's trace ID, with span_store).

**Authentication:** `bearerAuth`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `name` | path | string, required, max length 120 | Dataset name within the key team |
| `run` | path | string, required |  |
| `page` | query | integer, default `1`, min 1, max 100000 |  |
| `limit` | query | integer, default `50`, min 1, max 100 |  |
| `fields` | query | string | Comma-separated: core, evaluations, cost, trace |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Run and one page of items | `application/json`: object |
| `400` | page or limit out of range | — |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | scope_forbidden or team_required | — |
| `404` | Feature disabled, or no such dataset or run in the key team | — |
| `409` | ambiguous_name: several runs have this name; use the ID | — |

Response `200` fields:

- `application/json`: object
  - `run` ([PublicEvalRun](/docs/api/schemas/p/#publicevalrun))
  - `items` (array of [PublicEvalRunItem](/docs/api/schemas/p/#publicevalrunitem))
  - `meta` ([EvalPageMeta](/docs/api/schemas/e/#evalpagemeta))


## Start a regression suite run for CI

`POST /v1/eval-suites/{id}/runs` · operation `createPublicSuiteRun`

T186.012 (regression_suites, experiment_traces, evals_public_api). A key of the suite's team with evals:write starts a run of the suite (the gateway calls the model and the judges); the answer is the verdict, running at first. A valid traceparent header is recorded on every item's request span (experiment_ci_traceparent): each item keeps its own trace, joined to the CI's by that attribute. Poll GET /v1/eval-suites/runs/{run} until exit_code is set: 0 passed, 1 failed (below min_pass_rate), 2 error (the run failed or was canceled). A suite of another team answers 404.

**Authentication:** `bearerAuth`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |
| `X-Request-Id` | header | string, max length 128 | Correlation ID echoed in the response and forwarded upstream when valid. |

**Responses**

| Status | Description | Body |
|---|---|---|
| `201` | The verdict (running) | `application/json`: [SuiteVerdict](/docs/api/schemas/s/#suiteverdict) |
| `400` | The suite can no longer run | — |
| `403` | Key without evals:write or without a team | — |
| `404` | Feature disabled, not in the team's plan, or no such suite of the key's team | — |


## Plan an agent evaluation (tasks x targets x trials)

`POST /v1/agent-evals` · operation `createAgentEval`

T201 (agent_evaluations, experiment_traces, evals_public_api). A key of a team with evals:write plans an evaluation that its client-side runner executes: one API run per target over a dataset of the team, all at one dataset instant. With tasks, they are written to the team's dataset named dataset_name, created and kept by the runner (marked managed_by agent_eval; only tasks that changed get a new version, recorded as a dataset version by the key); a console dataset of that name answers 409 dataset_not_runner_kept. With task_ids, they are items of an existing dataset of the team, read as they are. tasks x trials is at most 2000 per target. Run names are '&lt;name&gt; · &lt;label&gt;'; a name the team already used answers 409. No agent code runs in the gateway: the runner calls the models through the gateway with a traceparent of its own per trial and records outcomes with POST /v1/agent-evals/{id}/results.

**Authentication:** `bearerAuth`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `X-Request-Id` | header | string, max length 128 | Correlation ID echoed in the response and forwarded upstream when valid. |

**Request body** (required)

- `application/json`: [AgentEvalCreate](/docs/api/schemas/a/#agentevalcreate)

**Responses**

| Status | Description | Body |
|---|---|---|
| `201` | The plan, with each target's run | `application/json`: [AgentEval](/docs/api/schemas/a/#agenteval) |
| `400` | Invalid plan (unknown field, bounds) | — |
| `403` | Key without evals:write or without a team | — |
| `404` | Feature disabled, not in the team's plan, no such dataset, or a task that is not an item of it (task_not_found) | — |
| `409` | Name already used (duplicate), a console dataset of that name with tasks (dataset_not_runner_kept), or the tasks changed before the plan (tasks_changed) | — |


## Read an agent evaluation and its scorecard

`GET /v1/agent-evals/{id}` · operation `getAgentEval`

T201 (agent_evaluations). A key of the evaluation's team with evals:read reads the plan and the scorecard per target: planned, recorded, passed, failed, errors and missing trials; pass_rate (errors and missing trials count as not passed), pass_at_k (tasks with a passing trial) and pass_all_k (tasks whose every trial passed); agent_cost, judge_cost and total_cost from the usage ledger (the team's usage events of each trial's trace and judge trace since the plan; state known, partial, unknown or none; unknown is never zero); cost_per_success_usd (total known cost over passing trials; a lower bound when partial; null with unknown cost or no pass); tokens and model calls from the ledger, tool calls as the runner reported them; latency (the trial's wall clock as the runner measured it) and model_latency (the sum of its model calls' durations), mean, p50 and p95; failure_classes; metrics_complete; per task recorded, passed and errors; and the recommended target (lowest cost per success within five points of the best pass rate). trials=&lt;label&gt; adds that target's trials with their checks and ledgers.

**Authentication:** `bearerAuth`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |
| `trials` | query | string | A target label: list its trials |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | The plan and its scorecard | `application/json`: [AgentEvalScorecardRead](/docs/api/schemas/a/#agentevalscorecardread) |
| `400` | Invalid trials label | — |
| `404` | Feature disabled, not in the team's plan, or no such evaluation of the key's team | — |


## Record trial outcomes of an agent evaluation

`POST /v1/agent-evals/{id}/results` · operation `recordAgentResults`

T201 (agent_evaluations). A key of the evaluation's team with evals:write records 1-100 trial outcomes, each the run item &lt;task_id&gt;:t&lt;trial&gt; of its target's run. The runner sends what only it knows: the outcome (pass, fail or error), a failure class (default wrong_answer for fail, error for error; none for pass), the trial's wall-clock latency_ms, the tool calls its harness made, its checks' verdicts (at most 20, details at most 500 characters) and the trial's trace_id and judge_trace_id (32 hex digits; the judge checks run in their own trace). Cost, tokens and model calls are read from the gateway's ledger by those traces, never from the client. A recorded attempt is final: the same traces again replace its outcome (a retried post), other traces answer 409 trial_recorded; a trace any other run item of the team holds answers 409 trace_claimed.

**Authentication:** `bearerAuth`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required |  |

**Request body** (required)

- `application/json`: [AgentResults](/docs/api/schemas/a/#agentresults)

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Recorded | `application/json`: object |
| `400` | Invalid result (target, task, trial, outcome, bounds) | — |
| `403` | Key without evals:write or without a team | — |
| `404` | Feature disabled, not in the team's plan, or no such evaluation of the key's team | — |
| `409` | trace_claimed or trial_recorded | — |

Response `200` fields:

- `application/json`: object
  - `recorded` (integer, required)
  - `created` (integer, required)


## Read the verdict of a suite run

`GET /v1/eval-suites/runs/{run}` · operation `getPublicSuiteRun`

T186.012 (regression_suites). A key of the run's team with evals:read reads the verdict: passed (exit_code 0), failed (1), error (2) or running (no exit_code yet).

**Authentication:** `bearerAuth`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `run` | path | string, required |  |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | The verdict | `application/json`: [SuiteVerdict](/docs/api/schemas/s/#suiteverdict) |
| `404` | Feature disabled or no such suite run of the key's team | — |


## Post back the outputs of a remote experiment's items

`POST /v1/eval-remote/runs/{run}/items` · operation `postRemoteRunOutputs`

T186.012b (remote_experiments). A callback endpoint posts 1-100 outputs of its run's pending items with the run's token (Authorization: Bearer rrt_…, answered once when the run is created). Each item is accepted once; the run's worker judges it and makes it a trace. An item the run does not hold, or one already answered, is listed in rejected. Items with no output within evaluation.remote_experiments.callback_wait fail.

**Authentication:** `bearerAuth`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `run` | path | string, required |  |

**Request body** (required)

- `application/json`: object
  - `items` (array of object, required, min items 1, max items 100)
    - `item_id` (string, required)
    - `output` (string)
    - `error` (string)
    - `latency_ms` (integer)

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | {accepted, rejected} | — |
| `400` | Invalid body | — |
| `401` | Unknown token, or the run is closed | — |
| `404` | Feature disabled | — |


## Open a run whose items a client links

`POST /v1/dataset-runs` · operation `createPublicDatasetRun`

Requires evals_public_api and key scope evals:write. Opens an API run on a dataset of the key team, pinned to the dataset at dataset_as_of (database clock): items are linked with POST /v1/dataset-run-items. The name is unique among the API runs of the dataset (409 duplicate). model is a free label shown by the console; the run never calls a model.

**Authentication:** `bearerAuth`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `X-Request-Id` | header | string, max length 128 | Correlation ID echoed in the response and forwarded upstream when valid. |

**Request body** (required)

- `application/json`: object
  - `dataset_name` (string, required)
  - `name` (string, required, max length 120)
  - `description` (string, max length 1000)
  - `metadata` (object) — At most 4 KiB
  - `model` (string, max length 120)

**Responses**

| Status | Description | Body |
|---|---|---|
| `201` | Run | `application/json`: [PublicEvalRun](/docs/api/schemas/p/#publicevalrun) |
| `400` | Invalid body | — |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | scope_forbidden or team_required | — |
| `404` | Feature disabled, or no dataset with this name in the key team | — |
| `409` | duplicate: an API run of this dataset has the name | — |


## Record the result of one dataset item in a run

`POST /v1/dataset-run-items` · operation `linkPublicDatasetRunItem`

Requires evals_public_api and key scope evals:write. Names the run by run_id, or by dataset_name and run_name (the API run with that name, opened on first use). The item is read at the run's dataset_as_of; an item created later answers 404. Send output (a JSON string, or any JSON value stored as compact JSON, at most 64 KiB) or error. request_id links the gateway request that produced the output: it must be a recorded request of the key team (400 request_not_found otherwise; the call waits up to 3 seconds for the usage ledger row, which is written after the response, and a streamed response's row lands when the stream ends), latency and tokens then come from the usage ledger (latency_ms is refused), and a request that failed makes the item failed. Without request_id, latency_ms is the client measure. Linking the same item again replaces its result (200). Console runs answer 409 invalid_state; a run holds at most 2000 items (409 run_full).

**Authentication:** `bearerAuth`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `X-Request-Id` | header | string, max length 128 | Correlation ID echoed in the response and forwarded upstream when valid. |

**Request body** (required)

- `application/json`: object
  - `run_id` (string)
  - `dataset_name` (string)
  - `run_name` (string, max length 120)
  - `run_description` (string, max length 1000)
  - `run_metadata` (object)
  - `item_id` (string, required, pattern `^[A-Za-z0-9_.-]{1,64}$`)
  - `output` (any) — The application's answer
  - `error` (string, max length 2000)
  - `request_id` (string, max length 128)
  - `latency_ms` (integer, min 0, max 3600000)

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Result replaced | `application/json`: [PublicEvalRunLink](/docs/api/schemas/p/#publicevalrunlink) |
| `201` | Item linked | `application/json`: [PublicEvalRunLink](/docs/api/schemas/p/#publicevalrunlink) |
| `400` | invalid_run_item with the reason, or request_not_found | — |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | scope_forbidden or team_required | — |
| `404` | Feature disabled, unknown dataset or run of the key team, or item_not_found | — |
| `409` | invalid_state (console run) or run_full | — |

