Evals API
This page documents the 102 gateway endpoints tagged evals in the gateway's OpenAPI document. Every example targets a gateway on http://localhost:4000 and authenticates with the SPANWAY_API_KEY environment variable, which holds the master key or a virtual key that has access to the route. Request and response fields are taken from the schema the running gateway publishes at /openapi.json, and the same document is bundled with this site as openapi.json.
| Method | Path | Summary |
|---|---|---|
| POST | /eval/datasets/from_logs | Build an eval dataset from logged production requests |
| GET | /eval/logs/preview | Preview the logged requests a dataset would be built from |
| POST | /eval/datasets/from_sessions | Build an eval dataset from whole logged conversations |
| GET | /eval/sessions/preview | Preview the conversations a dataset would be built from |
| GET | /eval/datasets | List eval datasets |
| POST | /eval/datasets | Create an eval dataset from items you send |
| POST | /eval/datasets/import | Create an eval dataset from a JSONL or CSV file |
| GET | /eval/datasets/{dataset_id} | Read one eval dataset with its items |
| PATCH | /eval/datasets/{dataset_id} | Rename an eval dataset or replace its items |
| DELETE | /eval/datasets/{dataset_id} | Delete an eval dataset with its runs |
| GET | /eval/datasets/{dataset_id}/versions | List the versions of an eval dataset |
| GET | /eval/datasets/{dataset_id}/versions/{version} | Read one version of an eval dataset |
| DELETE | /eval/datasets/{dataset_id}/versions/{version} | Delete an earlier version of an eval dataset |
| GET | /eval/scorers | List the scorers an eval run can use |
| GET | /eval/runs | List eval runs |
| POST | /eval/runs | Start an eval run of a dataset across models |
| GET | /eval/runs/{run_id} | Read one eval run and its summary |
| DELETE | /eval/runs/{run_id} | Delete a finished eval run with its results |
| GET | /eval/runs/{run_id}/results | List the results of an eval run |
| GET | /eval/runs/{run_id}/results/{result_id} | Read one eval result with its transcript |
| POST | /eval/runs/{run_id}/cancel | Cancel an eval run |
| GET | /eval/shadow | List shadow eval verdicts as eval results |
| POST | /eval/compare | Compare eval runs item by item |
| POST | /eval/playground | Try a prompt on a few dataset items |
| GET | /eval/runs/{run_id}/verdict | Get the pass or fail verdict of an eval run |
| GET | /eval/redteam/catalogue | List the vulnerabilities and attacks a red team run can use |
| GET | /eval/redteam/runs | List red team runs |
| POST | /eval/redteam/runs | Start a red team run against a model |
| GET | /eval/redteam/runs/{run_id} | Read a red team run and its summary |
| DELETE | /eval/redteam/runs/{run_id} | Delete a finished red team run |
| GET | /eval/redteam/runs/{run_id}/results | List the attacks of a red team run with their outcomes |
| POST | /eval/redteam/runs/{run_id}/cancel | Cancel a red team run |
| POST | /eval/datasets/synthesize | Generate an eval dataset from your own documents |
| GET | /eval/schedules | List eval schedules |
| POST | /eval/schedules | Create an eval schedule |
| GET | /eval/schedules/{schedule_id} | Get an eval schedule |
| PATCH | /eval/schedules/{schedule_id} | Change an eval schedule |
| DELETE | /eval/schedules/{schedule_id} | Delete an eval schedule |
| POST | /eval/schedules/{schedule_id}/run_now | Run an eval schedule now |
| GET | /eval/remote_scorers | List remote scorers |
| POST | /eval/remote_scorers | Register a remote scorer |
| GET | /eval/remote_scorers/{scorer_id} | Read one remote scorer |
| PATCH | /eval/remote_scorers/{scorer_id} | Change a remote scorer |
| DELETE | /eval/remote_scorers/{scorer_id} | Delete a remote scorer |
| POST | /eval/remote_scorers/{scorer_id}/rotate_secret | Rotate a remote scorer's signing secret |
| POST | /eval/scorers/test | Try a scorer on one output |
| GET | /eval/online/rules | List the online scoring rules |
| POST | /eval/online/rules | Create an online scoring rule |
| GET | /eval/online/rules/{rule_id} | Read one online scoring rule |
| PATCH | /eval/online/rules/{rule_id} | Change an online scoring rule |
| DELETE | /eval/online/rules/{rule_id} | Delete an online scoring rule |
| GET | /eval/online/scores | List the scores online rules gave to requests |
| GET | /eval/online/summary | Summarize online scores per hour or day |
| POST | /eval/online/rules/test | Try an online scoring rule before saving it |
| POST | /eval/online/rules/cost_preview | Preview what an online scoring rule will cost |
| GET | /eval/online/rules/{rule_id}/sampling | Explain whether a rule samples a request |
| GET | /eval/online/rules/{rule_id}/versions | List the saved versions of an online scoring rule |
| POST | /eval/online/rules/{rule_id}/versions/{version}/restore | Restore a saved version of an online scoring rule |
| GET | /eval/online/rules/{rule_id}/agreement | Compare an online scoring rule with human reviewers |
| GET | /eval/online/rules/{rule_id}/backfills | List the backfills of an online scoring rule |
| POST | /eval/online/rules/{rule_id}/backfills | Score past traffic with an online scoring rule |
| GET | /eval/online/rules/{rule_id}/backfills/{backfill_id} | Read one backfill of an online scoring rule |
| POST | /eval/online/rules/{rule_id}/backfills/{backfill_id}/cancel | Cancel a running backfill |
| GET | /eval/review/queues | List review queues |
| POST | /eval/review/queues | Create a review queue |
| GET | /eval/review/queues/{queue_id} | Get a review queue |
| PATCH | /eval/review/queues/{queue_id} | Change a review queue |
| DELETE | /eval/review/queues/{queue_id} | Delete a review queue |
| POST | /eval/review/queues/{queue_id}/from_run | Add eval run results to a review queue |
| POST | /eval/review/queues/{queue_id}/from_logs | Add sampled production responses to a review queue |
| POST | /eval/review/queues/{queue_id}/from_shadow | Add shadowed requests to a review queue |
| GET | /eval/review/queues/{queue_id}/items | List the items of a review queue |
| GET | /eval/review/queues/{queue_id}/items/{review_item_id} | Get a review item with its labels |
| DELETE | /eval/review/queues/{queue_id}/items/{review_item_id} | Remove an item from a review queue |
| GET | /eval/review/queues/{queue_id}/calibration | Compare human labels with automated scorers |
| POST | /eval/review/queues/{queue_id}/to_dataset | Export decided review items as a golden dataset |
| GET | /eval/review/assigned | List the review queues assigned to you |
| POST | /eval/review/queues/{queue_id}/next | Claim the next item to review |
| GET | /eval/review/items/{review_item_id} | Get an item you are reviewing |
| POST | /eval/review/items/{review_item_id}/label | Label a review item |
| POST | /eval/review/items/{review_item_id}/skip | Skip a review item |
| GET | /eval/review/queues/{queue_id}/board | Show who is working on a review queue |
| POST | /eval/review/queues/{queue_id}/assign | Assign review items to reviewers |
| POST | /eval/review/queues/{queue_id}/unassign | Take review items back from reviewers |
| GET | /eval/review/queues/{queue_id}/agreement | Show how far reviewers agree with each other |
| GET | /eval/feedback | List end-user ratings |
| POST | /eval/feedback | Rate a gateway request on behalf of an end user |
| DELETE | /eval/feedback/{feedback_id} | Delete one end-user rating |
| GET | /eval/runs/{run_id}/items | Read the items a submitted eval run needs answered |
| POST | /eval/runs/{run_id}/outputs | Submit answers to a submitted eval run |
| POST | /eval/runs/{run_id}/finish | Finish a submitted eval run |
| GET | /v1/evals | List the evaluations at the model provider |
| POST | /v1/evals | Create an evaluation at the model provider |
| GET | /v1/evals/{eval_id} | Read one evaluation |
| POST | /v1/evals/{eval_id} | Rename an evaluation or change its labels |
| DELETE | /v1/evals/{eval_id} | Delete an evaluation |
| POST | /v1/evals/{eval_id}/cancel | Cancel an evaluation |
| GET | /v1/evals/{eval_id}/runs | List the runs of an evaluation |
| POST | /v1/evals/{eval_id}/runs | Start a run of an evaluation |
| GET | /v1/evals/{eval_id}/runs/{run_id} | Read one run and its results |
| POST | /v1/evals/{eval_id}/runs/{run_id} | Cancel a run |
| DELETE | /v1/evals/{eval_id}/runs/{run_id} | Delete a run |
Endpoints
POST /eval/datasets/from_logs
Build an eval dataset from logged production requests
Turns real traffic into a test set. The gateway samples spend log rows that match the filters, and each chosen row becomes one item whose input is the logged chat transcript, whose expected answer is the logged response when include_outputs_as_expected is set, and whose metadata records the request id, model, team, tags, cost and latency. Only rows that kept their bodies qualify, which needs general_settings.store_prompts_in_spend_logs. A caller acting for a team or an organization only ever draws that team's or organization's rows. Only proxy admins may call it. Answers 400 when no row matches or none kept its body.
Request body (application/json, schema NewEvalDatasetFromLogs):
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | The dataset name, unique within your team or organization |
description | string or null | No | What the dataset tests |
filters | LogFilters | Yes | Which logged requests to draw from |
sample | LogSample | Yes | How many requests to take and how to pick them |
include_outputs_as_expected | boolean | No | Use the logged answer as each item's expected answer |
Example request:
curl -X POST "http://localhost:4000/eval/datasets/from_logs" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "support-traffic-november",
"description": "Sampled support bot requests",
"filters": {
"start": "2026-11-01T00:00:00Z",
"end": "2026-11-20T00:00:00Z",
"models": [
"gpt-5.5"
],
"teams": [
"team-support"
],
"status": "success"
},
"sample": {
"size": 50,
"strategy": "random"
},
"include_outputs_as_expected": true
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json Spanway_EvalDatasetTable |
| 400 | The request breaks a rule the detail names | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 409 | The object already exists or is in a state that does not allow this change | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
dataset_id | string | Yes | The id of the dataset |
name | string | Yes | The dataset name, unique within its team or organization |
description | string or null | No | What the dataset tests |
items | array of EvalItem | Yes | The questions in the current version |
item_count | integer | Yes | How many items the current version holds |
owner_team_id | string or null | No | The team that owns the dataset |
owner_org_id | string or null | No | The organization that owns the dataset |
current_version | integer | No | The version number of the current items |
created_by | string or null | No | Who created the dataset |
created_at | string or null | No | When the dataset was created |
updated_at | string or null | No | When the dataset was last changed |
GET /eval/logs/preview
Preview the logged requests a dataset would be built from
Shows the newest spend log rows the filters select, how many rows match in total, and whether any of them kept the request and response bodies a dataset needs, so you can check the filters before building a dataset from logs. Proxy admins and proxy admin viewers may call it. Nothing is changed.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
limit | query | integer | No | |
start | query | string | Yes | |
end | query | string | Yes | |
models | query | array of string or null | No | |
tags | query | array of string or null | No | |
teams | query | array of string or null | No | |
keys | query | array of string or null | No | |
status | query | enum: "success", "failure", "all" | No | |
min_tokens | query | integer or null | No | |
max_tokens | query | integer or null | No |
Example request:
curl -X GET "http://localhost:4000/eval/logs/preview?start=string&end=string" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json LogPreview |
| 400 | The request breaks a rule the detail names | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
items | array of LogPreviewItem | Yes | The newest matching requests |
total | integer | Yes | How many requests match the filters |
bodies_available | boolean | Yes | Whether any of them kept the prompt and answer a dataset needs |
POST /eval/datasets/from_sessions
Build an eval dataset from whole logged conversations
Turns whole conversations into a test set, one item per session: the transcript of its request with the longest history (tool calls and tool results included) plus the logged reply. Sessions come from spend logs by session id or log filters, or from Lens by trace id. Redacted sessions are skipped, and so are sessions whose tool arguments or results were truncated when logged unless include_truncated is set. Each item keeps the data policy of the request it came from, and a caller acting for a team or an organization reads only its own spend logs. Only proxy admins may call it. Answers 400 when no session qualifies and 501 when Lens is asked for but not configured.
Request body (application/json, schema NewSessionsDataset):
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | The dataset name, unique within your team or organization |
description | string or null | No | What the dataset tests |
source | SpendLogSessionSource or LensTraceSource | Yes | Where the conversations come from, spend logs or Lens traces |
include_truncated | boolean | No | Keep sessions whose tool calls were cut short when logged |
Example request:
curl -X POST "http://localhost:4000/eval/datasets/from_sessions" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "billing-conversations",
"description": "Multi-turn billing chats with tool calls",
"source": {
"type": "spend_logs",
"session_ids": [
"sess-7d2a9c4e",
"sess-1b3d5f7a"
]
},
"include_truncated": false
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json Spanway_EvalDatasetTable |
| 400 | The request breaks a rule the detail names | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 409 | The object already exists or is in a state that does not allow this change | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
| 501 | The evals extra is not installed on this gateway | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
dataset_id | string | Yes | The id of the dataset |
name | string | Yes | The dataset name, unique within its team or organization |
description | string or null | No | What the dataset tests |
items | array of EvalItem | Yes | The questions in the current version |
item_count | integer | Yes | How many items the current version holds |
owner_team_id | string or null | No | The team that owns the dataset |
owner_org_id | string or null | No | The organization that owns the dataset |
current_version | integer | No | The version number of the current items |
created_by | string or null | No | Who created the dataset |
created_at | string or null | No | When the dataset was created |
updated_at | string or null | No | When the dataset was last changed |
GET /eval/sessions/preview
Preview the conversations a dataset would be built from
Shows at most 50 sessions the way from_sessions would turn them into items, with turn and tool call counts, how many were skipped and why, and whether logged bodies and Lens are available. Send session_id, or start and end, for spend logs, or trace_id for Lens. It reveals the same bodies as the log preview. Proxy admins and proxy admin viewers may call it. Nothing is changed.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
source | query | enum: "spend_logs", "lens" | No | |
session_id | query | array of string or null | No | |
trace_id | query | array of string or null | No | |
start | query | string or null | No | |
end | query | string or null | No | |
include_truncated | query | boolean | No | |
limit | query | integer | No |
Example request:
curl -X GET "http://localhost:4000/eval/sessions/preview" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json SessionPreview |
| 400 | The request breaks a rule the detail names | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
| 501 | The evals extra is not installed on this gateway | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
sessions | array of SessionPreviewRow | Yes | The sessions that would become items |
skipped_redacted | integer | Yes | Sessions skipped because their bodies were redacted |
skipped_truncated | integer | Yes | Sessions skipped because tool calls were cut short |
skipped_unreadable | integer | Yes | Sessions skipped because their logs could not be read |
skipped_policy | integer | Yes | Sessions skipped because their data policy could not be read |
bodies_available | boolean | Yes | Whether the gateway stores prompts and answers in spend logs |
lens_available | boolean | Yes | Whether Lens traces can be read on this gateway |
GET /eval/datasets
List eval datasets
Lists the eval datasets the caller can see, newest first, without their items, however large they are. A caller acting for a team or an organization sees only its own. Proxy admins, proxy admin viewers and custom roles with read access may call it. Nothing is changed.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
page | query | integer | No | |
page_size | query | integer | No |
Example request:
curl -X GET "http://localhost:4000/eval/datasets" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json EvalDatasetListResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
datasets | array of EvalDatasetSummary | Yes | The datasets on this page, newest first |
total | integer | Yes | How many rows match in all |
page | integer | Yes | The page number, counting from 1 |
page_size | integer | Yes | How many rows a page holds |
POST /eval/datasets
Create an eval dataset from items you send
Creates a named test set from the items in the request body. Each item is a question or conversation, optionally with the answer you expect. Items without an item_id get one, and repeated ids are refused with 400. Proxy admins and custom roles with write access may call it.
Request body (application/json, schema NewEvalDataset):
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | The dataset name, unique within your team or organization |
description | string or null | No | What the dataset tests |
items | array of NewEvalItem | Yes | The questions, each with the answer you expect if any |
Example request:
curl -X POST "http://localhost:4000/eval/datasets" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "refund-questions",
"description": "Support questions about refunds with the answer we expect",
"items": [
{
"input": "How long do refunds take?",
"expected": "Refunds are issued within 14 days."
},
{
"input": "Can I get a refund on a gift card?",
"expected": "Gift cards cannot be refunded."
}
]
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json Spanway_EvalDatasetTable |
| 400 | The request breaks a rule the detail names | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 409 | The object already exists or is in a state that does not allow this change | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
dataset_id | string | Yes | The id of the dataset |
name | string | Yes | The dataset name, unique within its team or organization |
description | string or null | No | What the dataset tests |
items | array of EvalItem | Yes | The questions in the current version |
item_count | integer | Yes | How many items the current version holds |
owner_team_id | string or null | No | The team that owns the dataset |
owner_org_id | string or null | No | The organization that owns the dataset |
current_version | integer | No | The version number of the current items |
created_by | string or null | No | Who created the dataset |
created_at | string or null | No | When the dataset was created |
updated_at | string or null | No | When the dataset was last changed |
POST /eval/datasets/import
Create an eval dataset from a JSONL or CSV file
Creates a named test set from the text of a file you already have: JSONL with one item object per line, or CSV with an input column and optional expected, context, retrieval_context and metadata columns. Rows that do not parse are refused with 400. Proxy admins and custom roles with write access may call it.
Request body (application/json, schema ImportEvalDataset):
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | The dataset name, unique within your team or organization |
description | string or null | No | What the dataset tests |
format | enum: "jsonl", "csv" | Yes | jsonl for one item object per line, csv for a header row and one item per row |
content | string | Yes | The text of the file |
Example request:
curl -X POST "http://localhost:4000/eval/datasets/import" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "refund-questions",
"description": "Imported from the support FAQ",
"format": "csv",
"content": "input,expected\nHow long do refunds take?,Refunds are issued within 14 days.\n"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json Spanway_EvalDatasetTable |
| 400 | The request breaks a rule the detail names | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 409 | The object already exists or is in a state that does not allow this change | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
dataset_id | string | Yes | The id of the dataset |
name | string | Yes | The dataset name, unique within its team or organization |
description | string or null | No | What the dataset tests |
items | array of EvalItem | Yes | The questions in the current version |
item_count | integer | Yes | How many items the current version holds |
owner_team_id | string or null | No | The team that owns the dataset |
owner_org_id | string or null | No | The organization that owns the dataset |
current_version | integer | No | The version number of the current items |
created_by | string or null | No | Who created the dataset |
created_at | string or null | No | When the dataset was created |
updated_at | string or null | No | When the dataset was last changed |
GET /eval/datasets/{dataset_id}
Read one eval dataset with its items
Returns one eval dataset with its current items. Answers 404 when the id is unknown or outside the caller's team or organization. Proxy admins, proxy admin viewers and custom roles with read access may call it. Nothing is changed.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
dataset_id | path | string | Yes |
Example request:
curl -X GET "http://localhost:4000/eval/datasets/dataset_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json Spanway_EvalDatasetTable |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
dataset_id | string | Yes | The id of the dataset |
name | string | Yes | The dataset name, unique within its team or organization |
description | string or null | No | What the dataset tests |
items | array of EvalItem | Yes | The questions in the current version |
item_count | integer | Yes | How many items the current version holds |
owner_team_id | string or null | No | The team that owns the dataset |
owner_org_id | string or null | No | The organization that owns the dataset |
current_version | integer | No | The version number of the current items |
created_by | string or null | No | Who created the dataset |
created_at | string or null | No | When the dataset was created |
updated_at | string or null | No | When the dataset was last changed |
PATCH /eval/datasets/{dataset_id}
Rename an eval dataset or replace its items
Renames a dataset, changes its description, or replaces its items wholesale. New items become the dataset's next version unless they are identical to the current ones, and earlier runs keep their results and the version they ran. Proxy admins and custom roles with write access may call it, and the change is written to the audit log.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
dataset_id | path | string | Yes |
Request body (application/json, schema UpdateEvalDataset):
| Field | Type | Required | Description |
|---|---|---|---|
name | string or null | No | A new name for the dataset |
description | string or null | No | A new description |
items | array of NewEvalItem or null | No | Items that replace every current item and become the next version |
Example request:
curl -X PATCH "http://localhost:4000/eval/datasets/dataset_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"description": "Refund questions, updated for the new 30 day policy",
"items": [
{
"item_id": "refund-time",
"input": "How long do refunds take?",
"expected": "Refunds are issued within 30 days."
}
]
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json Spanway_EvalDatasetTable |
| 400 | The request breaks a rule the detail names | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 409 | The object already exists or is in a state that does not allow this change | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
dataset_id | string | Yes | The id of the dataset |
name | string | Yes | The dataset name, unique within its team or organization |
description | string or null | No | What the dataset tests |
items | array of EvalItem | Yes | The questions in the current version |
item_count | integer | Yes | How many items the current version holds |
owner_team_id | string or null | No | The team that owns the dataset |
owner_org_id | string or null | No | The organization that owns the dataset |
current_version | integer | No | The version number of the current items |
created_by | string or null | No | Who created the dataset |
created_at | string or null | No | When the dataset was created |
updated_at | string or null | No | When the dataset was last changed |
DELETE /eval/datasets/{dataset_id}
Delete an eval dataset with its runs
Deletes a dataset with every run and result of it. Refused with 409 while a run of it is still going. Proxy admins and custom roles with write access may call it, and the change is written to the audit log.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
dataset_id | path | string | Yes |
Example request:
curl -X DELETE "http://localhost:4000/eval/datasets/dataset_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json Spanway_EvalDatasetTable |
| 400 | The request breaks a rule the detail names | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
dataset_id | string | Yes | The id of the dataset |
name | string | Yes | The dataset name, unique within its team or organization |
description | string or null | No | What the dataset tests |
items | array of EvalItem | Yes | The questions in the current version |
item_count | integer | Yes | How many items the current version holds |
owner_team_id | string or null | No | The team that owns the dataset |
owner_org_id | string or null | No | The organization that owns the dataset |
current_version | integer | No | The version number of the current items |
created_by | string or null | No | Who created the dataset |
created_at | string or null | No | When the dataset was created |
updated_at | string or null | No | When the dataset was last changed |
GET /eval/datasets/{dataset_id}/versions
List the versions of an eval dataset
Lists every saved version of a dataset, newest first, without the items. A new version is saved each time the items are replaced, so earlier runs can still be traced to the exact items they used. Proxy admins, proxy admin viewers and custom roles with read access may call it. Nothing is changed.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
dataset_id | path | string | Yes | |
page | query | integer | No | |
page_size | query | integer | No |
Example request:
curl -X GET "http://localhost:4000/eval/datasets/dataset_id-123/versions" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json EvalDatasetVersionListResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
versions | array of EvalDatasetVersionSummary | Yes | Every saved version, newest first |
current_version | integer | Yes | The version the dataset uses now |
GET /eval/datasets/{dataset_id}/versions/{version}
Read one version of an eval dataset
Returns one saved version of a dataset with the items it held at that time. Answers 404 when the dataset or the version does not exist. Proxy admins, proxy admin viewers and custom roles with read access may call it. Nothing is changed.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
dataset_id | path | string | Yes | |
version | path | integer | Yes |
Example request:
curl -X GET "http://localhost:4000/eval/datasets/dataset_id-123/versions/version-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json Spanway_EvalDatasetVersion |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
dataset_id | string | Yes | The dataset this version belongs to |
version | integer | Yes | The version number, counting up from 1 |
item_count | integer | Yes | How many items the version holds |
items_digest | string | Yes | A SHA-256 fingerprint of the items, equal for identical items |
created_by | string or null | No | Who saved this version |
created_at | string or null | No | When this version was saved |
items | array of EvalItem | Yes | The items this version held |
DELETE /eval/datasets/{dataset_id}/versions/{version}
Delete an earlier version of an eval dataset
Deletes an earlier version of a dataset for good, for example one holding an item that must not be kept. The current version cannot be deleted, so replace the items first, and neither can a version a run still in progress is pinned to. Finished runs of it keep their results, and comparing them reads the current items. Proxy admins and custom roles with write access may call it, and the change is written to the audit log.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
dataset_id | path | string | Yes | |
version | path | integer | Yes |
Example request:
curl -X DELETE "http://localhost:4000/eval/datasets/dataset_id-123/versions/version-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json EvalDatasetVersionSummary |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 409 | The object already exists or is in a state that does not allow this change | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
dataset_id | string | Yes | The dataset this version belongs to |
version | integer | Yes | The version number, counting up from 1 |
item_count | integer | Yes | How many items the version holds |
items_digest | string | Yes | A SHA-256 fingerprint of the items, equal for identical items |
created_by | string or null | No | Who saved this version |
created_at | string or null | No | When this version was saved |
GET /eval/scorers
List the scorers an eval run can use
Lists every scorer type a run can grade answers with, with its config fields and the item fields it needs, so the Admin UI can build the run form. Scorers that need a component this gateway does not have are listed with available false. Proxy admins, proxy admin viewers and custom roles with read access may call it. Nothing is changed.
Example request:
curl -X GET "http://localhost:4000/eval/scorers" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json array of ScorerDescription |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 500 | The database is not connected | application/json ErrorDetail |
GET /eval/runs
List eval runs
Lists eval runs newest first, narrowed by dataset, status, the schedule that started them, the prompt they rendered, their mode, their baseline key or the git ref CI reported. Only the caller's own runs are listed. Proxy admins, proxy admin viewers, custom roles with read access and ci keys may call it, and a ci key lists only the runs it started. Nothing is changed.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
dataset_id | query | string or null | No | |
status | query | enum: "pending", "running", "completed", "failed", "cancelled" or null | No | |
schedule_id | query | string or null | No | |
prompt_id | query | string or null | No | |
mode | query | enum: "single", "replay", "agent", "logged" or null | No | |
baseline_key | query | string or null | No | |
git_ref | query | string or null | No | |
page | query | integer | No | |
page_size | query | integer | No |
Example request:
curl -X GET "http://localhost:4000/eval/runs" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json EvalRunListResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
runs | array of Spanway_EvalRunTable | Yes | The runs on this page, newest first |
total | integer | Yes | How many rows match in all |
page | integer | Yes | The page number, counting from 1 |
page_size | integer | Yes | How many rows a page holds |
POST /eval/runs
Start an eval run of a dataset across models
Tests one dataset against one or more models and grades every answer with the chosen scorer, so you can compare models or prompts before changing what production uses. The run starts in the background and comes back pending, then moves to running and completed. Every model, the judge included, must be served by the gateway, and a prompt_id must name a managed prompt the gateway has loaded. Transcript scorers need replay, agent or logged mode, agent mode needs tools on every item, and replay and logged need conversations. A remote scorer must be registered and enabled, and the run is pinned to its current revision.
Proxy admins and ci keys may start runs. A ci key's run must use an allowlisted dataset and models the key and its team may call, its key and team budgets must have room, and its completions count against the key's rate limits. The run is a trusted baseline only when an admin or a baseline writer ci key started it on an allowed ref and no pull request.
Request body (application/json, schema NewEvalRun):
| Field | Type | Required | Description |
|---|---|---|---|
dataset_id | string or null | No | The dataset to test, or name it with dataset_name instead |
dataset_name | string or null | No | The name of the dataset to test, or send dataset_id instead |
dataset_version | integer or null | No | An earlier version of the items to test, the current one by default |
outputs_source | enum: "dataset", "submitted" | No | dataset to call models, submitted to score outputs you send in later |
models | array of string | No | The models to send every item to, as named on the gateway |
scorer | object | Yes | How to grade answers, with type and settings, see the scorers list |
name | string or null | No | A label for the run |
concurrency | integer | No | How many items are sent at once, from 1 to 32 |
prompt_id | string or null | No | A managed prompt to render every item through |
prompt_version | integer or null | No | The version of that prompt, the current one by default |
prompt_environment | string or null | No | The environment to take that version from, the one requests get by default when unset |
mode | enum: "single", "replay", "agent", "logged" | No | single, replay, agent or logged, which decides how items are sent |
max_steps | integer or null | No | The most agent steps per item in agent mode, up to 25 |
template | PromptTemplate or null | No | A system prompt or user template applied to every item |
params | InferenceParams or null | No | Sampling settings sent with every call |
baseline_key | string or null | No | The key CI compares runs under, letters, digits, dot, dash and underscore |
gate | EvalGate or null | No | The pass rate thresholds CI checks the run against |
ci | CiContext or null | No | Details about the CI job that started the run |
Example request:
curl -X POST "http://localhost:4000/eval/runs" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"dataset_name": "refund-questions",
"models": [
"gpt-5.5",
"claude-sonnet-5-5"
],
"scorer": {
"type": "contains",
"substrings": [
"14 days"
]
},
"name": "refund answers, two models",
"concurrency": 4
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json Spanway_EvalRunTable |
| 400 | The request breaks a rule the detail names | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 429 | A ci key already has as many runs in progress as EVAL_CI_MAX_ACTIVE_RUNS allows | application/json ErrorDetail |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
run_id | string | Yes | The id of the eval run |
dataset_id | string | Yes | The dataset the run tests |
dataset_version | integer or null | No | The dataset version the run is pinned to |
name | string or null | No | A label for the run |
models | array of string | Yes | The models the run sends every item to |
scorer | object | Yes | How answers are graded, with the scorer type and its settings |
status | enum: "pending", "running", "completed", "failed", "cancelled" | Yes | pending, running, completed, failed or cancelled |
summary | EvalSummary or null | No | The per model totals, once the run completed |
error | string or null | No | Why the run failed |
schedule_id | string or null | No | The schedule that started the run |
prompt_id | string or null | No | The managed prompt the run rendered |
prompt_version | integer or null | No | The version of the managed prompt the run used |
prompt_environment | string or null | No | The prompt environment the version was taken from |
mode | enum: "single", "replay", "agent", "logged" | No | single, replay, agent or logged, which decides how items are sent |
outputs_source | enum: "dataset", "submitted" | No | dataset when the gateway calls models, submitted when outputs are sent in |
max_steps | integer or null | No | The most agent steps per item in agent mode |
template | StoredPromptTemplate or null | No | The prompt template applied to every item |
params | StoredInferenceParams or null | No | The sampling settings sent with every call |
items_digest | string or null | No | The fingerprint of the items the run tested |
baseline_key | string or null | No | The key CI compares runs under |
git_ref | string or null | No | The git branch or tag CI reported |
git_sha | string or null | No | The git commit CI reported |
ci | CiContext or null | No | Details CI sent about the pipeline that started the run |
gate | EvalGate or null | No | The pass rate thresholds CI checks the run against |
trusted_baseline | boolean | No | Whether later CI runs may be compared with this one |
owner_team_id | string or null | No | The team that owns the run |
owner_org_id | string or null | No | The organization that owns the run |
created_by | string or null | No | Who started the run |
created_at | string or null | No | When the run was created |
started_at | string or null | No | When the first item was sent |
completed_at | string or null | No | When the run finished |
GET /eval/runs/{run_id}
Read one eval run and its summary
Returns one eval run with its status and, once it completed, the per model summary of scores, pass rate, latency and cost and the best model. Proxy admins, proxy admin viewers, custom roles with read access and ci keys may call it, and a ci key sees only the runs it started. Nothing is changed.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
run_id | path | string | Yes |
Example request:
curl -X GET "http://localhost:4000/eval/runs/run_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json Spanway_EvalRunTable |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
run_id | string | Yes | The id of the eval run |
dataset_id | string | Yes | The dataset the run tests |
dataset_version | integer or null | No | The dataset version the run is pinned to |
name | string or null | No | A label for the run |
models | array of string | Yes | The models the run sends every item to |
scorer | object | Yes | How answers are graded, with the scorer type and its settings |
status | enum: "pending", "running", "completed", "failed", "cancelled" | Yes | pending, running, completed, failed or cancelled |
summary | EvalSummary or null | No | The per model totals, once the run completed |
error | string or null | No | Why the run failed |
schedule_id | string or null | No | The schedule that started the run |
prompt_id | string or null | No | The managed prompt the run rendered |
prompt_version | integer or null | No | The version of the managed prompt the run used |
prompt_environment | string or null | No | The prompt environment the version was taken from |
mode | enum: "single", "replay", "agent", "logged" | No | single, replay, agent or logged, which decides how items are sent |
outputs_source | enum: "dataset", "submitted" | No | dataset when the gateway calls models, submitted when outputs are sent in |
max_steps | integer or null | No | The most agent steps per item in agent mode |
template | StoredPromptTemplate or null | No | The prompt template applied to every item |
params | StoredInferenceParams or null | No | The sampling settings sent with every call |
items_digest | string or null | No | The fingerprint of the items the run tested |
baseline_key | string or null | No | The key CI compares runs under |
git_ref | string or null | No | The git branch or tag CI reported |
git_sha | string or null | No | The git commit CI reported |
ci | CiContext or null | No | Details CI sent about the pipeline that started the run |
gate | EvalGate or null | No | The pass rate thresholds CI checks the run against |
trusted_baseline | boolean | No | Whether later CI runs may be compared with this one |
owner_team_id | string or null | No | The team that owns the run |
owner_org_id | string or null | No | The organization that owns the run |
created_by | string or null | No | Who started the run |
created_at | string or null | No | When the run was created |
started_at | string or null | No | When the first item was sent |
completed_at | string or null | No | When the run finished |
DELETE /eval/runs/{run_id}
Delete a finished eval run with its results
Deletes a finished eval run with its results. A run still going must be cancelled first. Proxy admins and custom roles with write access may call it, and the change is written to the audit log.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
run_id | path | string | Yes |
Example request:
curl -X DELETE "http://localhost:4000/eval/runs/run_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json Spanway_EvalRunTable |
| 400 | The request breaks a rule the detail names | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
run_id | string | Yes | The id of the eval run |
dataset_id | string | Yes | The dataset the run tests |
dataset_version | integer or null | No | The dataset version the run is pinned to |
name | string or null | No | A label for the run |
models | array of string | Yes | The models the run sends every item to |
scorer | object | Yes | How answers are graded, with the scorer type and its settings |
status | enum: "pending", "running", "completed", "failed", "cancelled" | Yes | pending, running, completed, failed or cancelled |
summary | EvalSummary or null | No | The per model totals, once the run completed |
error | string or null | No | Why the run failed |
schedule_id | string or null | No | The schedule that started the run |
prompt_id | string or null | No | The managed prompt the run rendered |
prompt_version | integer or null | No | The version of the managed prompt the run used |
prompt_environment | string or null | No | The prompt environment the version was taken from |
mode | enum: "single", "replay", "agent", "logged" | No | single, replay, agent or logged, which decides how items are sent |
outputs_source | enum: "dataset", "submitted" | No | dataset when the gateway calls models, submitted when outputs are sent in |
max_steps | integer or null | No | The most agent steps per item in agent mode |
template | StoredPromptTemplate or null | No | The prompt template applied to every item |
params | StoredInferenceParams or null | No | The sampling settings sent with every call |
items_digest | string or null | No | The fingerprint of the items the run tested |
baseline_key | string or null | No | The key CI compares runs under |
git_ref | string or null | No | The git branch or tag CI reported |
git_sha | string or null | No | The git commit CI reported |
ci | CiContext or null | No | Details CI sent about the pipeline that started the run |
gate | EvalGate or null | No | The pass rate thresholds CI checks the run against |
trusted_baseline | boolean | No | Whether later CI runs may be compared with this one |
owner_team_id | string or null | No | The team that owns the run |
owner_org_id | string or null | No | The organization that owns the run |
created_by | string or null | No | Who started the run |
created_at | string or null | No | When the run was created |
started_at | string or null | No | When the first item was sent |
completed_at | string or null | No | When the run finished |
GET /eval/runs/{run_id}/results
List the results of an eval run
Lists the graded answers of one run, oldest first, one row per item and model with the output, score, pass or fail, latency and cost. Filter by model or by passed. Proxy admins, proxy admin viewers, custom roles with read access and ci keys may call it, and a ci key reads only the runs it started. Nothing is changed.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
run_id | path | string | Yes | |
model | query | string or null | No | |
passed | query | boolean or null | No | |
page | query | integer | No | |
page_size | query | integer | No |
Example request:
curl -X GET "http://localhost:4000/eval/runs/run_id-123/results" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json EvalResultListResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
results | array of Spanway_EvalResultTable | Yes | The results on this page, oldest first |
total | integer | Yes | How many rows match in all |
page | integer | Yes | The page number, counting from 1 |
page_size | integer | Yes | How many rows a page holds |
GET /eval/runs/{run_id}/results/{result_id}
Read one eval result with its transcript
Returns one graded answer with the full conversation transcript its replay, agent or logged run stored, and why the conversation stopped. Result lists never carry the transcript. Proxy admins, proxy admin viewers and custom roles with read access may call it. Nothing is changed.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
run_id | path | string | Yes | |
result_id | path | string | Yes |
Example request:
curl -X GET "http://localhost:4000/eval/runs/run_id-123/results/result_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json EvalResultDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
result | Spanway_EvalResultTable | Yes | The graded answer |
transcript | array of SystemMessage or UserMessage or AssistantMessage or ToolMessage or null | Yes | The whole conversation for replay, agent and logged runs |
stop | enum: "finished", "max_steps", "logged" or null | Yes | Why the conversation ended |
trace_id | string or null | Yes | The trace of the conversation, when tracing is on |
POST /eval/runs/{run_id}/cancel
Cancel an eval run
Stops a pending or running eval run before its next item. Results already stored stay. Proxy admins, custom roles with write access and ci keys may call it, a ci key cancels only the runs it started, and the cancellation is written to the audit log.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
run_id | path | string | Yes |
Request body (application/json, schema CancelEvalRun):
| Field | Type | Required | Description |
|---|---|---|---|
reason | string or null | No | Why the run is stopped, kept in the audit log |
Example request:
curl -X POST "http://localhost:4000/eval/runs/run_id-123/cancel" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"reason": "Started against the wrong dataset"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json Spanway_EvalRunTable |
| 400 | The request breaks a rule the detail names | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
run_id | string | Yes | The id of the eval run |
dataset_id | string | Yes | The dataset the run tests |
dataset_version | integer or null | No | The dataset version the run is pinned to |
name | string or null | No | A label for the run |
models | array of string | Yes | The models the run sends every item to |
scorer | object | Yes | How answers are graded, with the scorer type and its settings |
status | enum: "pending", "running", "completed", "failed", "cancelled" | Yes | pending, running, completed, failed or cancelled |
summary | EvalSummary or null | No | The per model totals, once the run completed |
error | string or null | No | Why the run failed |
schedule_id | string or null | No | The schedule that started the run |
prompt_id | string or null | No | The managed prompt the run rendered |
prompt_version | integer or null | No | The version of the managed prompt the run used |
prompt_environment | string or null | No | The prompt environment the version was taken from |
mode | enum: "single", "replay", "agent", "logged" | No | single, replay, agent or logged, which decides how items are sent |
outputs_source | enum: "dataset", "submitted" | No | dataset when the gateway calls models, submitted when outputs are sent in |
max_steps | integer or null | No | The most agent steps per item in agent mode |
template | StoredPromptTemplate or null | No | The prompt template applied to every item |
params | StoredInferenceParams or null | No | The sampling settings sent with every call |
items_digest | string or null | No | The fingerprint of the items the run tested |
baseline_key | string or null | No | The key CI compares runs under |
git_ref | string or null | No | The git branch or tag CI reported |
git_sha | string or null | No | The git commit CI reported |
ci | CiContext or null | No | Details CI sent about the pipeline that started the run |
gate | EvalGate or null | No | The pass rate thresholds CI checks the run against |
trusted_baseline | boolean | No | Whether later CI runs may be compared with this one |
owner_team_id | string or null | No | The team that owns the run |
owner_org_id | string or null | No | The organization that owns the run |
created_by | string or null | No | Who started the run |
created_at | string or null | No | When the run was created |
started_at | string or null | No | When the first item was sent |
completed_at | string or null | No | When the run finished |
GET /eval/shadow
List shadow eval verdicts as eval results
Lists the verdicts that shadow eval jobs stored, newest first, in the shape of eval results. A shadow eval sends a copy of live requests to a second model and has a judge compare the answers, so you can see whether a cheaper or newer model holds up on real traffic. The model filter matches either the shadow or the live model. Proxy admins, proxy admin viewers and custom roles with read access may call it. Nothing is changed.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
model | query | string or null | No | |
start | query | string or null | No | |
end | query | string or null | No | |
page | query | integer | No | |
page_size | query | integer | No |
Example request:
curl -X GET "http://localhost:4000/eval/shadow" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json ShadowEvalListResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
results | array of ShadowEvalResult | Yes | The verdicts on this page, newest first |
total | integer | Yes | How many rows match in all |
page | integer | Yes | The page number, counting from 1 |
page_size | integer | Yes | How many rows a page holds |
POST /eval/compare
Compare eval runs item by item
Put two to four eval runs of one dataset side by side to see which items got better or worse, for example
before promoting a new prompt version. Proxy admins and admin viewers may call it, and nothing is stored.
Arm 0 is the baseline. Each arm's change on an item is decided in order by a missing result (incomparable),
an error on one side only (new_error, error_fixed), a pass flip whatever the score did (pass_to_fail,
fail_to_pass), then a score move larger than tolerance. Totals cover every item whatever the filter and page,
and outputs are cut to a 4000 character preview.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/evals#comparing-runs)
Request body (application/json, schema CompareEvalRuns):
| Field | Type | Required | Description |
|---|---|---|---|
arms | array of CompareArm | Yes | Two to four run and model pairs, the first is the baseline |
tolerance | number | No | How far a score may move before it counts as a change |
filter | enum: "all", "regressed", "improved", "changed", "unchanged", "incomparable" | No | Which items to list, the totals always cover every item |
sort | enum: "dataset", "score_delta" | No | List items in dataset order or by score change |
page | integer | No | The page of items, from 1 |
page_size | integer | No | Items per page, at most 50 |
Example request:
curl -X POST "http://localhost:4000/eval/compare" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"arms": [
{
"run_id": "run-a",
"model": "gpt-5.5"
},
{
"run_id": "run-b",
"model": "gpt-5.5"
}
],
"filter": "regressed",
"tolerance": 0.05
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The arms side by side with per-arm totals | application/json EvalComparison |
| 400 | The arms cover different datasets, models or modes, or hold too many results together | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 429 | A ci key already has as many runs in progress as EVAL_CI_MAX_ACTIVE_RUNS allows | application/json ErrorDetail |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
dataset_id | string | Yes | The dataset every arm ran on |
arms | array of ComparisonArm | Yes | Each arm's run settings and summary, the baseline first |
totals | array of ArmTotals | Yes | How each arm differs from the baseline over every item |
warnings | array of ScorersDiffer or ArmsDatasetDiffer or DatasetChanged or RunIncomplete or OrphanItems | Yes | Reasons the comparison may mislead |
items | array of ComparedItem | Yes | This page of items with each arm's result |
total_items | integer | Yes | Items in the dataset |
filtered_items | integer | Yes | Items the filter keeps |
page | integer | Yes | The page returned |
page_size | integer | Yes | Items per page |
POST /eval/playground
Try a prompt on a few dataset items
Try a system prompt and an {{input}} user template, or a managed prompt, on a few dataset items before
starting a full run. Only proxy admins may call it. At most 20 items and 3 models (30 pairs) run while the
request waits. Nothing is stored, but every completion is routed, billed to the caller and labelled
spanway_eval playground in its spend log metadata. Pairs still running after 45 seconds come back as timed out
errors, and a proxy instance runs at most 4 playground requests at once, answering 429 beyond that.
A random sample returns its seed so sending it again draws the same items.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/evals#playground)
Request body (application/json, schema RunEvalPlayground):
| Field | Type | Required | Description |
|---|---|---|---|
dataset_id | string | Yes | The dataset to draw items from |
sample | ListedItems or FirstItems or RandomItems | Yes | Which items to try: listed ids, the first few or a random few |
models | array of string | Yes | One to three models to try |
template | PromptTemplate or null | No | A system prompt and a user template |
prompt_id | string or null | No | A managed prompt to use instead |
prompt_version | integer or null | No | The managed prompt version, latest if unset |
params | InferenceParams or null | No | Sampling settings such as temperature |
scorer | object or null | No | A scorer to grade the outputs with |
concurrency | integer | No | How many pairs run at once, at most 8 |
Example request:
curl -X POST "http://localhost:4000/eval/playground" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"dataset_id": "6c1f0d2e-8a4b-4c3d-9e7f-1a2b3c4d5e6f",
"sample": {
"mode": "random",
"size": 5
},
"models": [
"gpt-5.5",
"claude-sonnet-5-5"
],
"template": {
"system": "Answer in one word.",
"user_template": "Question: {{input}}"
},
"params": {
"temperature": 0
},
"scorer": {
"type": "contains",
"substrings": [
"Paris"
]
}
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The outputs, scores and the first rendered prompt | application/json EvalPlaygroundResponse |
| 400 | The sample, models, template or scorer do not fit the playground | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 429 | Four playground requests are running on this instance already | application/json ErrorDetail |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
seed | integer or null | Yes | The random sample's seed, send it again to draw the same items |
item_ids | array of string | Yes | The items that were tried |
rendered_example | RenderedExample | Yes | The first item's messages as the first model got them |
results | array of PlaygroundResult | Yes | One result per item and model pair |
summary | EvalSummary or null | Yes | Per-model scores, when a scorer was sent |
timed_out | boolean | Yes | Whether some pairs ran past 45 seconds |
GET /eval/runs/{run_id}/verdict
Get the pass or fail verdict of an eval run
Tells you whether an eval run passed its quality gate, for example before a CI job lets a prompt or model change merge. Each threshold of the run's gate is checked per model and compared with a baseline run: the baseline_run_id you pass, else the one the gate names, else the newest trusted completed run with the same baseline_key on the gate's branch (refs/heads/main by default) that finished before this run started. For a run a CI key started, the automatic baseline comes from the same key or its team, so every reader sees the verdict the CI job saw.
While the run is still going the conclusion is pending and no results are read. The answer carries a ready to post markdown report; report_detail=summary leaves item ids and the run link out of it, for public repositories. Reading changes nothing and reads only scores, never model outputs.
Any key that may read evals can call it, and a CI key may only name runs it can see. Needs an Enterprise license with evals.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
run_id | path | string | Yes | |
baseline_run_id | query | string or null | No | |
report_detail | query | enum: "full", "summary" | No |
Example request:
curl -X GET "http://localhost:4000/eval/runs/run_id-123/verdict" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The run's verdict against its gate and baseline | application/json EvalVerdict |
| 400 | The request breaks a rule the detail names | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
run_id | string | Yes | The eval run the verdict is for. |
status | enum: "pending", "running", "completed", "failed", "cancelled" | Yes | Where the run is: pending, running, completed, failed or cancelled. |
conclusion | enum: "pending", "passed", "failed", "neutral", "error" | Yes | pending, passed, failed, neutral or error, as described above. |
reason | string or null | No | Why the conclusion is error or neutral. |
baseline_run_id | string or null | No | The run this one was compared with, empty when there is no baseline. |
baseline_reason | string or null | No | How the baseline was chosen or why there is none. |
checks | array of GateCheck | No | Every threshold of the gate, checked per model. |
models | array of ModelComparison | No | Per model figures beside the baseline run's. |
regressed_items | array of RegressedItem | No | The first items that got worse than in the baseline, at most 50. |
regressed_item_count | integer | No | How many items got worse in all. |
markdown | string | No | The report as markdown, ready to post on a pull request. |
run_url | string or null | No | An https link to the run in the Admin UI. |
GET /eval/redteam/catalogue
List the vulnerabilities and attacks a red team run can use
Every vulnerability with its types and every attack technique the proxy can run, so a form or a script can
build a valid run request. available is false when the evals extra is not installed on the proxy.
Example request:
curl -X GET "http://localhost:4000/eval/redteam/catalogue" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json RedTeamCatalogue |
| 400 | The request breaks a rule the detail names | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The license lacks evals or the caller's role is refused | application/json RedTeamErrorResponse |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 500 | The database is not connected, or the proxy has no models configured | application/json RedTeamErrorResponse |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
available | boolean | Yes | Available |
vulnerabilities | array of VulnerabilityDescription | Yes | Vulnerabilities |
attacks | array of AttackDescription | Yes | Attacks |
frameworks | array of FrameworkPreset | No | The risk framework presets a run can start from |
GET /eval/redteam/runs
List red team runs
The caller's runs, newest first, optionally narrowed to one status. A team sees its own runs, an organization its own and its teams', and the operator every run.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
status | query | enum: "pending", "running", "completed", "failed", "cancelled" or null | No | |
page | query | integer | No | |
page_size | query | integer | No |
Example request:
curl -X GET "http://localhost:4000/eval/redteam/runs" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json RedTeamRunListResponse |
| 400 | The request breaks a rule the detail names | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The license lacks evals or the caller's role is refused | application/json RedTeamErrorResponse |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected, or the proxy has no models configured | application/json RedTeamErrorResponse |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
runs | array of Spanway_RedTeamRunTable | Yes | The runs on this page, newest first |
total | integer | Yes | How many rows match in all |
page | integer | Yes | The page number, counting from 1 |
page_size | integer | Yes | How many rows a page holds |
POST /eval/redteam/runs
Start a red team run against a model
Starts the assessment in the background and returns the run pending. The target, simulator and evaluator
must all be served by the proxy, and the vulnerabilities and attacks must come from the catalogue. Instead of
vulnerabilities and attacks, framework names a preset of the catalogue: a category framework such as
mitre_atlas or eu_ai_act probes what its categories list, and a dataset framework such as aegis
or beavertails sends the prompts you supply, up to 200. Once the run completes, its summary
carries the pass rates, the framework categories and the CVSS score with its severity.
Request body (application/json, schema NewRedTeamRun):
| Field | Type | Required | Description |
|---|---|---|---|
target_model | string | Yes | The model or alias to attack, as named on the gateway |
framework | enum: "owasp_top_10_llm", "owasp_top_10_agentic", "nist_ai_rmf", "mitre_atlas", "eu_ai_act" or enum: "aegis", "beavertails" or null | No | Start from a framework preset of the catalogue instead of naming vulnerabilities |
vulnerabilities | array of RedTeamVulnerability | No | The vulnerabilities to test, see the red team catalogue, empty with a framework |
attacks | array of string | No | The attack methods to use, the catalogue default when empty |
prompts | array of DatasetPrompt | No | The dataset prompts a dataset framework such as aegis sends, up to 200, empty otherwise |
simulator_model | string | Yes | The model that writes the attacks |
evaluation_model | string | Yes | The model that judges whether each attack succeeded |
attacks_per_vulnerability | integer | No | How many attacks to write per vulnerability type, from 1 to 20 |
target_purpose | string or null | No | What the target is for, which helps write realistic attacks |
name | string or null | No | A label for the run |
max_concurrent | integer | No | How many attacks run at once, from 1 to 32 |
Example request:
curl -X POST "http://localhost:4000/eval/redteam/runs" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "support bot, weekly",
"target_model": "support-bot",
"simulator_model": "claude-sonnet-latest",
"evaluation_model": "claude-opus-latest",
"vulnerabilities": [
{
"name": "PIILeakage",
"types": [
"direct_disclosure"
]
},
{
"name": "Bias",
"types": []
}
],
"attacks": [
"PromptInjection",
"LinearJailbreaking"
],
"attacks_per_vulnerability": 2,
"target_purpose": "A customer support assistant for an online bank",
"max_concurrent": 4
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json Spanway_RedTeamRunTable |
| 400 | The request names something the proxy lacks | application/json RedTeamErrorResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The license lacks evals or the caller's role is refused | application/json RedTeamErrorResponse |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected, or the proxy has no models configured | application/json RedTeamErrorResponse |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
run_id | string | Yes | The id of the red team run |
name | string or null | No | A label for the run |
target_model | string | Yes | The model being attacked |
simulator_model | string | Yes | The model that writes the attacks |
evaluation_model | string | Yes | The model that judges whether each attack succeeded |
vulnerabilities | array of RedTeamVulnerability | Yes | The vulnerabilities tested |
attacks | array of string | Yes | The attack methods used |
attacks_per_vulnerability | integer | Yes | How many attacks are written for each vulnerability type |
target_purpose | string or null | No | What the target is for, which helps write realistic attacks |
framework | string or null | No | The risk framework preset the run started from, such as mitre_atlas or aegis |
status | enum: "pending", "running", "completed", "failed", "cancelled" | Yes | pending, running, completed, failed or cancelled |
summary | RedTeamSummary or null | No | The results, once the run completed |
error | string or null | No | Why the run failed |
owner_team_id | string or null | No | The team that owns the run |
owner_org_id | string or null | No | The organization that owns the run |
created_by | string or null | No | Who started the run |
created_at | string or null | No | When the run was created |
started_at | string or null | No | When the run started |
completed_at | string or null | No | When the run finished |
GET /eval/redteam/runs/{run_id}
Read a red team run and its summary
The run with its summary once it completed: the overall pass rate, the pass rate by vulnerability type, by attack and by framework category, and the mean CVSS score of the evaluated attacks with its severity.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
run_id | path | string | Yes |
Example request:
curl -X GET "http://localhost:4000/eval/redteam/runs/run_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json Spanway_RedTeamRunTable |
| 400 | The request breaks a rule the detail names | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The license lacks evals or the caller's role is refused | application/json RedTeamErrorResponse |
| 404 | No run with this id is visible to the caller | application/json RedTeamErrorResponse |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected, or the proxy has no models configured | application/json RedTeamErrorResponse |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
run_id | string | Yes | The id of the red team run |
name | string or null | No | A label for the run |
target_model | string | Yes | The model being attacked |
simulator_model | string | Yes | The model that writes the attacks |
evaluation_model | string | Yes | The model that judges whether each attack succeeded |
vulnerabilities | array of RedTeamVulnerability | Yes | The vulnerabilities tested |
attacks | array of string | Yes | The attack methods used |
attacks_per_vulnerability | integer | Yes | How many attacks are written for each vulnerability type |
target_purpose | string or null | No | What the target is for, which helps write realistic attacks |
framework | string or null | No | The risk framework preset the run started from, such as mitre_atlas or aegis |
status | enum: "pending", "running", "completed", "failed", "cancelled" | Yes | pending, running, completed, failed or cancelled |
summary | RedTeamSummary or null | No | The results, once the run completed |
error | string or null | No | Why the run failed |
owner_team_id | string or null | No | The team that owns the run |
owner_org_id | string or null | No | The organization that owns the run |
created_by | string or null | No | Who started the run |
created_at | string or null | No | When the run was created |
started_at | string or null | No | When the run started |
completed_at | string or null | No | When the run finished |
DELETE /eval/redteam/runs/{run_id}
Delete a finished red team run
Deletes a finished run with its results. A run still going must be cancelled first.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
run_id | path | string | Yes |
Example request:
curl -X DELETE "http://localhost:4000/eval/redteam/runs/run_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json Spanway_RedTeamRunTable |
| 400 | The run is still pending or running, cancel it first | application/json RedTeamErrorResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The license lacks evals or the caller's role is refused | application/json RedTeamErrorResponse |
| 404 | No run with this id is visible to the caller | application/json RedTeamErrorResponse |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected, or the proxy has no models configured | application/json RedTeamErrorResponse |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
run_id | string | Yes | The id of the red team run |
name | string or null | No | A label for the run |
target_model | string | Yes | The model being attacked |
simulator_model | string | Yes | The model that writes the attacks |
evaluation_model | string | Yes | The model that judges whether each attack succeeded |
vulnerabilities | array of RedTeamVulnerability | Yes | The vulnerabilities tested |
attacks | array of string | Yes | The attack methods used |
attacks_per_vulnerability | integer | Yes | How many attacks are written for each vulnerability type |
target_purpose | string or null | No | What the target is for, which helps write realistic attacks |
framework | string or null | No | The risk framework preset the run started from, such as mitre_atlas or aegis |
status | enum: "pending", "running", "completed", "failed", "cancelled" | Yes | pending, running, completed, failed or cancelled |
summary | RedTeamSummary or null | No | The results, once the run completed |
error | string or null | No | Why the run failed |
owner_team_id | string or null | No | The team that owns the run |
owner_org_id | string or null | No | The organization that owns the run |
created_by | string or null | No | Who started the run |
created_at | string or null | No | When the run was created |
started_at | string or null | No | When the run started |
completed_at | string or null | No | When the run finished |
GET /eval/redteam/runs/{run_id}/results
List the attacks of a red team run with their outcomes
One row per attack: the prompt, the target's reply, the judge's score and reason, whether the target withstood it, and the CVSS score with its severity. Filters narrow by vulnerability, attack and outcome.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
run_id | path | string | Yes | |
vulnerability | query | string or null | No | |
attack | query | string or null | No | |
passed | query | boolean or null | No | |
page | query | integer | No | |
page_size | query | integer | No |
Example request:
curl -X GET "http://localhost:4000/eval/redteam/runs/run_id-123/results" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json RedTeamResultListResponse |
| 400 | The request breaks a rule the detail names | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The license lacks evals or the caller's role is refused | application/json RedTeamErrorResponse |
| 404 | No run with this id is visible to the caller | application/json RedTeamErrorResponse |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected, or the proxy has no models configured | application/json RedTeamErrorResponse |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
results | array of Spanway_RedTeamResultTable | Yes | The attack results on this page |
total | integer | Yes | How many rows match in all |
page | integer | Yes | The page number, counting from 1 |
page_size | integer | Yes | How many rows a page holds |
POST /eval/redteam/runs/{run_id}/cancel
Cancel a red team run
Stops a pending run before it starts, or keeps a running one from completing. The assessment runs as a single call, so a running one finishes its work but the run stays cancelled.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
run_id | path | string | Yes |
Request body (application/json, schema CancelEvalRun):
| Field | Type | Required | Description |
|---|---|---|---|
reason | string or null | No | Why the run is stopped, kept in the audit log |
Example request:
curl -X POST "http://localhost:4000/eval/redteam/runs/run_id-123/cancel" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"reason": "Started against the wrong model alias"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json Spanway_RedTeamRunTable |
| 400 | The run is not in a state that allows this, only a pending or running run can be cancelled | application/json RedTeamErrorResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The license lacks evals or the caller's role is refused | application/json RedTeamErrorResponse |
| 404 | No run with this id is visible to the caller | application/json RedTeamErrorResponse |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected, or the proxy has no models configured | application/json RedTeamErrorResponse |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
run_id | string | Yes | The id of the red team run |
name | string or null | No | A label for the run |
target_model | string | Yes | The model being attacked |
simulator_model | string | Yes | The model that writes the attacks |
evaluation_model | string | Yes | The model that judges whether each attack succeeded |
vulnerabilities | array of RedTeamVulnerability | Yes | The vulnerabilities tested |
attacks | array of string | Yes | The attack methods used |
attacks_per_vulnerability | integer | Yes | How many attacks are written for each vulnerability type |
target_purpose | string or null | No | What the target is for, which helps write realistic attacks |
framework | string or null | No | The risk framework preset the run started from, such as mitre_atlas or aegis |
status | enum: "pending", "running", "completed", "failed", "cancelled" | Yes | pending, running, completed, failed or cancelled |
summary | RedTeamSummary or null | No | The results, once the run completed |
error | string or null | No | Why the run failed |
owner_team_id | string or null | No | The team that owns the run |
owner_org_id | string or null | No | The organization that owns the run |
created_by | string or null | No | Who started the run |
created_at | string or null | No | When the run was created |
started_at | string or null | No | When the run started |
completed_at | string or null | No | When the run finished |
POST /eval/datasets/synthesize
Generate an eval dataset from your own documents
Builds a starter test set when you have documents but no example questions yet. For each passage in
synthesis.contexts the model you name writes questions a user could ask, refines them, and, when
include_expected_output is true, answers them from the passage. The result is saved as a new eval dataset
in the caller's scope, recorded in the audit log without its items, and returned.
Proxy admins, or a custom role that grants eval writes, may call it. Every generation call runs through the gateway as the caller, so its budget, rate limits, guardrails and data policies apply. Only the text sent here is used, never logged traffic, and the request stops at a fixed number of model calls. An unknown model answers 400, a dataset name already in use answers 409, a gateway without the evals extra answers 501, and a generation the model could not finish answers 502.
Request body (application/json, schema NewSyntheticDataset):
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Name |
description | string or null | No | Description |
synthesis | SynthesisRequest | Yes |
Example request:
curl -X POST "http://localhost:4000/eval/datasets/synthesize" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "refund-policy-starter",
"synthesis": {
"model": "my-model",
"contexts": [
[
"Refunds are issued within 14 days of a returned item reaching the warehouse."
]
],
"goldens_per_context": 2,
"scenario": "customers asking a support chatbot",
"task": "answer refund questions"
}
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The new dataset with its generated items | application/json Spanway_EvalDatasetTable |
| 400 | The request breaks a rule the detail names | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 409 | The object already exists or is in a state that does not allow this change | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
| 501 | The evals extra is not installed on this gateway | application/json ErrorDetail |
| 502 | The generation model failed or produced nothing usable | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
dataset_id | string | Yes | The id of the dataset |
name | string | Yes | The dataset name, unique within its team or organization |
description | string or null | No | What the dataset tests |
items | array of EvalItem | Yes | The questions in the current version |
item_count | integer | Yes | How many items the current version holds |
owner_team_id | string or null | No | The team that owns the dataset |
owner_org_id | string or null | No | The organization that owns the dataset |
current_version | integer | No | The version number of the current items |
created_by | string or null | No | Who created the dataset |
created_at | string or null | No | When the dataset was created |
updated_at | string or null | No | When the dataset was last changed |
GET /eval/schedules
List eval schedules
Lists the eval schedules, newest first, a page at a time. Set enabled to see only enabled or only paused
schedules. Proxy admins, admin viewers and custom roles with evals.read may call it, each seeing only what
its team or organization owns. It changes nothing.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/evals#scheduled-runs-and-regression-alerts)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
enabled | query | boolean or null | No | |
page | query | integer | No | |
page_size | query | integer | No |
Example request:
curl -X GET "http://localhost:4000/eval/schedules" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | One page of schedules, newest first | application/json EvalScheduleListResponse |
| 400 | The request breaks a rule the detail names | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 409 | The object already exists or is in a state that does not allow this change | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
schedules | array of Spanway_EvalScheduleTable | Yes | Schedules |
total | integer | Yes | Total |
page | integer | Yes | Page |
page_size | integer | Yes | Page Size |
POST /eval/schedules
Create an eval schedule
Creates a schedule that runs an eval on a cron, so a quality drop shows up the morning after a provider ships
a new model snapshot or someone edits a prompt. Each fire runs the models over a fixed dataset (dataset_id)
or over a fresh sample of request logs (from_logs), exactly one of the two. Each completed run is compared
with the previous one, and an eval_regression alert is raised when the pass rate drops by more than
alert.regression_threshold or under alert.min_pass_rate. cron has five fields read in timezone.
Before every fire the gateway checks that the creator is still a proxy admin and that the key it was created
with is not deleted, blocked or expired, and skips the fire otherwise. The new schedule is written to the
audit log. Only proxy admins may call it, and it needs the evals license feature.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/evals#scheduled-runs-and-regression-alerts)
Request body (application/json, schema NewEvalSchedule):
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Name |
dataset_id | string or null | No | Dataset Id |
from_logs | FromLogsSpec or null | No | |
models | array of string | Yes | Models |
scorer | object | Yes | Scorer |
prompt_id | string or null | No | Prompt Id |
prompt_version | integer or null | No | Prompt Version |
cron | string | Yes | Cron |
timezone | string | No | Timezone |
enabled | boolean | No | Enabled |
alert | EvalAlert | No | When a scheduled run raises an eval_regression alert: pass rate under min_pass_rate, or down by more |
Example request:
curl -X POST "http://localhost:4000/eval/schedules" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "nightly support regression",
"dataset_id": "ds_6c1f0b3a",
"models": [
"gpt-5.5",
"claude-sonnet-5-5"
],
"scorer": {
"type": "contains",
"substrings": [
"14 days"
]
},
"cron": "0 3 * * *",
"timezone": "Europe/Berlin",
"alert": {
"min_pass_rate": 0.85,
"regression_threshold": 0.05
}
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The new schedule with its first run time | application/json Spanway_EvalScheduleTable |
| 400 | Both or neither of dataset_id and from_logs were sent, or the cron or scorer is not valid | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller is not a proxy admin, or the license lacks the evals feature | application/json ErrorDetail |
| 404 | The dataset does not exist | application/json ErrorDetail |
| 409 | The owner already has a schedule with this name | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
schedule_id | string | Yes | Schedule Id |
name | string | Yes | Name |
dataset_id | string or null | No | Dataset Id |
from_logs | FromLogsSpec or null | No | |
models | array of string | Yes | Models |
scorer | object | Yes | Scorer |
prompt_id | string or null | No | Prompt Id |
prompt_version | integer or null | No | Prompt Version |
cron | string | Yes | Cron |
timezone | string | Yes | Timezone |
enabled | boolean | Yes | Enabled |
last_run_id | string or null | No | Last Run Id |
last_run_at | string or null | No | Last Run At |
next_run_at | string | Yes | Next Run At |
alert | EvalAlert | Yes | When a scheduled run raises an eval_regression alert: pass rate under min_pass_rate, or down by more |
owner_team_id | string or null | No | Owner Team Id |
owner_org_id | string or null | No | Owner Org Id |
created_by | string or null | No | Created By |
created_at | string or null | No | Created At |
updated_at | string or null | No | Updated At |
GET /eval/schedules/{schedule_id}
Get an eval schedule
Shows one eval schedule with its cron, models, scorer, alert thresholds and when it ran last and runs next. It answers 404 when the id is unknown or outside the caller's scope. Proxy admins, admin viewers and custom roles with evals.read may call it, each seeing only what its team or organization owns. It changes nothing.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/evals#scheduled-runs-and-regression-alerts)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
schedule_id | path | string | Yes |
Example request:
curl -X GET "http://localhost:4000/eval/schedules/schedule_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The schedule | application/json Spanway_EvalScheduleTable |
| 400 | The request breaks a rule the detail names | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 404 | No schedule has this id within the caller's scope | application/json ErrorDetail |
| 409 | The object already exists or is in a state that does not allow this change | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
schedule_id | string | Yes | Schedule Id |
name | string | Yes | Name |
dataset_id | string or null | No | Dataset Id |
from_logs | FromLogsSpec or null | No | |
models | array of string | Yes | Models |
scorer | object | Yes | Scorer |
prompt_id | string or null | No | Prompt Id |
prompt_version | integer or null | No | Prompt Version |
cron | string | Yes | Cron |
timezone | string | Yes | Timezone |
enabled | boolean | Yes | Enabled |
last_run_id | string or null | No | Last Run Id |
last_run_at | string or null | No | Last Run At |
next_run_at | string | Yes | Next Run At |
alert | EvalAlert | Yes | When a scheduled run raises an eval_regression alert: pass rate under min_pass_rate, or down by more |
owner_team_id | string or null | No | Owner Team Id |
owner_org_id | string or null | No | Owner Org Id |
created_by | string or null | No | Created By |
created_at | string or null | No | Created At |
updated_at | string or null | No | Updated At |
PATCH /eval/schedules/{schedule_id}
Change an eval schedule
Changes only the fields you send. Sending dataset_id clears from_logs and the other way round. Sending
prompt_id without prompt_version follows the prompt's latest version. A new cron, timezone or turning the
schedule back on recomputes next_run_at from now. The change is written to the audit log with the values
before and after. Only proxy admins may call it, and it needs the evals license feature.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/evals#scheduled-runs-and-regression-alerts)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
schedule_id | path | string | Yes |
Request body (application/json, schema UpdateEvalSchedule):
| Field | Type | Required | Description |
|---|---|---|---|
name | string or null | No | Name |
dataset_id | string or null | No | Dataset Id |
from_logs | FromLogsSpec or null | No | |
models | array of string or null | No | Models |
scorer | object or null | No | Scorer |
prompt_id | string or null | No | Prompt Id |
prompt_version | integer or null | No | Prompt Version |
cron | string or null | No | Cron |
timezone | string or null | No | Timezone |
enabled | boolean or null | No | Enabled |
alert | EvalAlert or null | No |
Example request:
curl -X PATCH "http://localhost:4000/eval/schedules/schedule_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"cron": "0 4 * * 1-5",
"alert": {
"min_pass_rate": 0.9
}
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The schedule as changed | application/json Spanway_EvalScheduleTable |
| 400 | Nothing was sent, or a field that cannot be null was null | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller is not a proxy admin, or the license lacks the evals feature | application/json ErrorDetail |
| 404 | No schedule has this id within the caller's scope | application/json ErrorDetail |
| 409 | The owner already has a schedule with this name | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
schedule_id | string | Yes | Schedule Id |
name | string | Yes | Name |
dataset_id | string or null | No | Dataset Id |
from_logs | FromLogsSpec or null | No | |
models | array of string | Yes | Models |
scorer | object | Yes | Scorer |
prompt_id | string or null | No | Prompt Id |
prompt_version | integer or null | No | Prompt Version |
cron | string | Yes | Cron |
timezone | string | Yes | Timezone |
enabled | boolean | Yes | Enabled |
last_run_id | string or null | No | Last Run Id |
last_run_at | string or null | No | Last Run At |
next_run_at | string | Yes | Next Run At |
alert | EvalAlert | Yes | When a scheduled run raises an eval_regression alert: pass rate under min_pass_rate, or down by more |
owner_team_id | string or null | No | Owner Team Id |
owner_org_id | string or null | No | Owner Org Id |
created_by | string or null | No | Created By |
created_at | string or null | No | Created At |
updated_at | string or null | No | Updated At |
DELETE /eval/schedules/{schedule_id}
Delete an eval schedule
Deletes the schedule so it never fires again. The runs it already started are kept and still listed under its
schedule_id. The deletion is written to the audit log. Only proxy admins may call it, and it needs the
evals license feature.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/evals#scheduled-runs-and-regression-alerts)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
schedule_id | path | string | Yes |
Example request:
curl -X DELETE "http://localhost:4000/eval/schedules/schedule_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The deleted schedule | application/json Spanway_EvalScheduleTable |
| 400 | The request breaks a rule the detail names | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller is not a proxy admin, or the license lacks the evals feature | application/json ErrorDetail |
| 404 | No schedule has this id within the caller's scope | application/json ErrorDetail |
| 409 | The object already exists or is in a state that does not allow this change | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
schedule_id | string | Yes | Schedule Id |
name | string | Yes | Name |
dataset_id | string or null | No | Dataset Id |
from_logs | FromLogsSpec or null | No | |
models | array of string | Yes | Models |
scorer | object | Yes | Scorer |
prompt_id | string or null | No | Prompt Id |
prompt_version | integer or null | No | Prompt Version |
cron | string | Yes | Cron |
timezone | string | Yes | Timezone |
enabled | boolean | Yes | Enabled |
last_run_id | string or null | No | Last Run Id |
last_run_at | string or null | No | Last Run At |
next_run_at | string | Yes | Next Run At |
alert | EvalAlert | Yes | When a scheduled run raises an eval_regression alert: pass rate under min_pass_rate, or down by more |
owner_team_id | string or null | No | Owner Team Id |
owner_org_id | string or null | No | Owner Org Id |
created_by | string or null | No | Created By |
created_at | string or null | No | Created At |
updated_at | string or null | No | Updated At |
POST /eval/schedules/{schedule_id}/run_now
Run an eval schedule now
Starts the schedule's run right away, exactly as the cron would, without moving next_run_at, for example to
check a prompt change before the nightly run. When the run finishes it is compared with the previous
completed run of the schedule. The run is written to the audit log. The run calls the models, so it costs
money. Only proxy admins may call it, and it needs the evals license feature.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/evals#scheduled-runs-and-regression-alerts)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
schedule_id | path | string | Yes |
Request body (application/json, schema RunEvalScheduleNow):
| Field | Type | Required | Description |
|---|---|---|---|
name | string or null | No | Name |
Example request:
curl -X POST "http://localhost:4000/eval/schedules/schedule_id-123/run_now" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "manual check before release"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The run that started | application/json Spanway_EvalRunTable |
| 400 | The run could not start, for example its dataset was deleted | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller is not a proxy admin, or the license lacks the evals feature | application/json ErrorDetail |
| 404 | No schedule has this id within the caller's scope | application/json ErrorDetail |
| 409 | The object already exists or is in a state that does not allow this change | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
run_id | string | Yes | The id of the eval run |
dataset_id | string | Yes | The dataset the run tests |
dataset_version | integer or null | No | The dataset version the run is pinned to |
name | string or null | No | A label for the run |
models | array of string | Yes | The models the run sends every item to |
scorer | object | Yes | How answers are graded, with the scorer type and its settings |
status | enum: "pending", "running", "completed", "failed", "cancelled" | Yes | pending, running, completed, failed or cancelled |
summary | EvalSummary or null | No | The per model totals, once the run completed |
error | string or null | No | Why the run failed |
schedule_id | string or null | No | The schedule that started the run |
prompt_id | string or null | No | The managed prompt the run rendered |
prompt_version | integer or null | No | The version of the managed prompt the run used |
prompt_environment | string or null | No | The prompt environment the version was taken from |
mode | enum: "single", "replay", "agent", "logged" | No | single, replay, agent or logged, which decides how items are sent |
outputs_source | enum: "dataset", "submitted" | No | dataset when the gateway calls models, submitted when outputs are sent in |
max_steps | integer or null | No | The most agent steps per item in agent mode |
template | StoredPromptTemplate or null | No | The prompt template applied to every item |
params | StoredInferenceParams or null | No | The sampling settings sent with every call |
items_digest | string or null | No | The fingerprint of the items the run tested |
baseline_key | string or null | No | The key CI compares runs under |
git_ref | string or null | No | The git branch or tag CI reported |
git_sha | string or null | No | The git commit CI reported |
ci | CiContext or null | No | Details CI sent about the pipeline that started the run |
gate | EvalGate or null | No | The pass rate thresholds CI checks the run against |
trusted_baseline | boolean | No | Whether later CI runs may be compared with this one |
owner_team_id | string or null | No | The team that owns the run |
owner_org_id | string or null | No | The organization that owns the run |
created_by | string or null | No | Who started the run |
created_at | string or null | No | When the run was created |
started_at | string or null | No | When the first item was sent |
completed_at | string or null | No | When the run finished |
GET /eval/remote_scorers
List remote scorers
List the registered remote scorers, newest first, optionally only enabled or disabled ones. Proxy admins
and admin viewers may call it. Secrets are never shown and each url is cut to its scheme and host. Nothing
changes. Docs (https://docs.spanway.ai/docs/proxy/enterprise/evals#custom-scorers)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
enabled | query | boolean or null | No | |
page | query | integer | No | |
page_size | query | integer | No |
Example request:
curl -X GET "http://localhost:4000/eval/remote_scorers" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | One page of scorers | application/json RemoteScorerListResponse |
| 400 | The request breaks a rule the detail names | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 409 | The object already exists or is in a state that does not allow this change | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
scorers | array of RemoteScorerView | Yes | Scorers |
total | integer | Yes | Total |
page | integer | Yes | Page |
page_size | integer | Yes | Page Size |
POST /eval/remote_scorers
Register a remote scorer
Register a scorer that runs on your own service, so eval runs can call it to grade outputs. Only proxy
admins may call it, and the registration is written to the audit log. The answer carries the signing secret
the gateway signs each request with, shown this once. The url must be https and public unless its host is in
user_url_allowed_hosts, and must be one of eval_remote_scorer_hosts when that is set.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/evals#registering-a-scorer)
Request body (application/json, schema NewRemoteScorer):
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Name |
description | string or null | No | Description |
url | string | Yes | Url |
timeout_ms | integer | No | Timeout Ms |
max_retries | integer | No | Max Retries |
max_concurrency | integer | No | Max Concurrency |
requires | array of enum: "expected", "context", "retrieval_context", "tools", "expected_tool_calls", "expected_outcome", "audio" | No | Requires |
self_hosted | boolean | No | Self Hosted |
Example request:
curl -X POST "http://localhost:4000/eval/remote_scorers" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "support-grader",
"url": "https://scorer.internal.example.com/score",
"requires": [
"expected"
]
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The scorer and its signing secret, shown this once | application/json RemoteScorerCreated |
| 400 | The url breaks the network rules for scorers | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 409 | A remote scorer has that name already | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
scorer | RemoteScorerView | Yes | A remote scorer without its secrets. endpoint is the scheme and host only, since webhook paths often |
signing_secret | string | Yes | Signing Secret |
GET /eval/remote_scorers/{scorer_id}
Read one remote scorer
Read one remote scorer. Proxy admins and admin viewers may call it. Secrets are never shown and the url is
cut to its scheme and host. Nothing changes.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/evals#custom-scorers)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
scorer_id | path | string | Yes |
Example request:
curl -X GET "http://localhost:4000/eval/remote_scorers/scorer_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The scorer without its secrets | application/json RemoteScorerView |
| 400 | The request breaks a rule the detail names | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 404 | No remote scorer has that id | application/json ErrorDetail |
| 409 | The object already exists or is in a state that does not allow this change | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
scorer_id | string | Yes | Scorer Id |
name | string | Yes | Name |
description | string or null | Yes | Description |
endpoint | string | Yes | Endpoint |
timeout_ms | integer | Yes | Timeout Ms |
max_retries | integer | Yes | Max Retries |
max_concurrency | integer | Yes | Max Concurrency |
requires | array of enum: "expected", "context", "retrieval_context", "tools", "expected_tool_calls", "expected_outcome", "audio" | Yes | Requires |
secret_hint | string | Yes | Secret Hint |
rotating | boolean | Yes | Rotating |
previous_secret_expires_at | string or null | Yes | Previous Secret Expires At |
revision | integer | Yes | Revision |
enabled | boolean | Yes | Enabled |
self_hosted | boolean | No | Self Hosted |
created_by | string or null | Yes | Created By |
created_at | string or null | Yes | Created At |
updated_at | string or null | Yes | Updated At |
PATCH /eval/remote_scorers/{scorer_id}
Change a remote scorer
Change a remote scorer, for example to raise its timeout or switch it off. Only proxy admins may call it,
and the before and after are written to the audit log. Only the fields sent change. A new url is checked
again, and a change to url, timeout_ms, max_retries, max_concurrency or requires starts a new revision: runs
already started finish on the revision they resolved, new runs and schedule fires take the new one.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/evals#custom-scorers)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
scorer_id | path | string | Yes |
Request body (application/json, schema UpdateRemoteScorer):
| Field | Type | Required | Description |
|---|---|---|---|
description | string or null | No | Description |
url | string or null | No | Url |
timeout_ms | integer or null | No | Timeout Ms |
max_retries | integer or null | No | Max Retries |
max_concurrency | integer or null | No | Max Concurrency |
requires | array of enum: "expected", "context", "retrieval_context", "tools", "expected_tool_calls", "expected_outcome", "audio" or null | No | Requires |
enabled | boolean or null | No | Enabled |
self_hosted | boolean or null | No | Self Hosted |
Example request:
curl -X PATCH "http://localhost:4000/eval/remote_scorers/scorer_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"timeout_ms": 20000,
"enabled": true
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The scorer after the change | application/json RemoteScorerView |
| 400 | Nothing was sent, a field was set to null, or the new url breaks the network rules | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 404 | No remote scorer has that id | application/json ErrorDetail |
| 409 | An enabled online scoring rule uses the scorer | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
scorer_id | string | Yes | Scorer Id |
name | string | Yes | Name |
description | string or null | Yes | Description |
endpoint | string | Yes | Endpoint |
timeout_ms | integer | Yes | Timeout Ms |
max_retries | integer | Yes | Max Retries |
max_concurrency | integer | Yes | Max Concurrency |
requires | array of enum: "expected", "context", "retrieval_context", "tools", "expected_tool_calls", "expected_outcome", "audio" | Yes | Requires |
secret_hint | string | Yes | Secret Hint |
rotating | boolean | Yes | Rotating |
previous_secret_expires_at | string or null | Yes | Previous Secret Expires At |
revision | integer | Yes | Revision |
enabled | boolean | Yes | Enabled |
self_hosted | boolean | No | Self Hosted |
created_by | string or null | Yes | Created By |
created_at | string or null | Yes | Created At |
updated_at | string or null | Yes | Updated At |
DELETE /eval/remote_scorers/{scorer_id}
Delete a remote scorer
Delete a remote scorer. Only proxy admins may call it, and the deletion is written to the audit log. It is
refused while a pending or running run, an enabled schedule or an enabled online rule uses the scorer.
Finished runs keep the scorer they stored, and running one of them again is refused.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/evals#custom-scorers)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
scorer_id | path | string | Yes |
Example request:
curl -X DELETE "http://localhost:4000/eval/remote_scorers/scorer_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The scorer as it was before deletion | application/json RemoteScorerView |
| 400 | A pending or running run or an enabled schedule uses the scorer | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 404 | No remote scorer has that id | application/json ErrorDetail |
| 409 | An enabled online scoring rule uses the scorer | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
scorer_id | string | Yes | Scorer Id |
name | string | Yes | Name |
description | string or null | Yes | Description |
endpoint | string | Yes | Endpoint |
timeout_ms | integer | Yes | Timeout Ms |
max_retries | integer | Yes | Max Retries |
max_concurrency | integer | Yes | Max Concurrency |
requires | array of enum: "expected", "context", "retrieval_context", "tools", "expected_tool_calls", "expected_outcome", "audio" | Yes | Requires |
secret_hint | string | Yes | Secret Hint |
rotating | boolean | Yes | Rotating |
previous_secret_expires_at | string or null | Yes | Previous Secret Expires At |
revision | integer | Yes | Revision |
enabled | boolean | Yes | Enabled |
self_hosted | boolean | No | Self Hosted |
created_by | string or null | Yes | Created By |
created_at | string or null | Yes | Created At |
updated_at | string or null | Yes | Updated At |
POST /eval/remote_scorers/{scorer_id}/rotate_secret
Rotate a remote scorer's signing secret
Issue a new signing secret for a remote scorer, for example after the old one leaked. Only proxy admins may
call it, and the rotation is written to the audit log. The new secret is shown this once. During the grace
window every request carries a signature with each secret, so the receiver can switch over without dropping
requests, and 0 drops the old secret at once.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/evals#verifying-the-signature)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
scorer_id | path | string | Yes |
Request body (application/json, schema RotateRemoteScorerSecret):
| Field | Type | Required | Description |
|---|---|---|---|
grace_seconds | integer | No | Grace Seconds |
Example request:
curl -X POST "http://localhost:4000/eval/remote_scorers/scorer_id-123/rotate_secret" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"grace_seconds": 86400
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The new signing secret, shown this once | application/json RemoteScorerCreated |
| 400 | The request breaks a rule the detail names | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 404 | No remote scorer has that id | application/json ErrorDetail |
| 409 | The object already exists or is in a state that does not allow this change | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
scorer | RemoteScorerView | Yes | A remote scorer without its secrets. endpoint is the scheme and host only, since webhook paths often |
signing_secret | string | Yes | Signing Secret |
POST /eval/scorers/test
Try a scorer on one output
Score one output with any scorer exactly as a run would, to check a scorer before using it in a run. Only
proxy admins may call it, and nothing is stored. A judge model must be served by the proxy and a remote scorer
must be registered and enabled. A scorer error comes back as a result, not a failure.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/evals#scorers)
Request body (application/json, schema DryRunScorer):
| Field | Type | Required | Description |
|---|---|---|---|
scorer | object | Yes | Scorer |
item | NewEvalItem | Yes | An item as the API or a file supplies it: the id is optional and minted when missing. The source data policy |
model | string | Yes | Model |
output | string | Yes | Output |
Example request:
curl -X POST "http://localhost:4000/eval/scorers/test" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"scorer": {
"type": "exact_match"
},
"item": {
"input": "What is the capital of France?",
"expected": "Paris"
},
"model": "gpt-5.5",
"output": "Paris"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The score, or the scorer's error as a result | application/json ScorerTestScored or ScorerTestError |
| 400 | The item or the scorer settings are not valid | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 409 | The object already exists or is in a state that does not allow this change | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
GET /eval/online/rules
List the online scoring rules
Every rule, newest first, with today's funnel (UTC): how many matched requests were scored, skipped by sampling, shed under load, over budget or unscorable, and the judge spend, which lag the spend flush by a few seconds. Only a proxy admin or an admin viewer may call it, since rules cover every team. Nothing is changed.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
enabled | query | boolean or null | No | |
page | query | integer | No | |
page_size | query | integer | No |
Example request:
curl -X GET "http://localhost:4000/eval/online/rules" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json OnlineEvalRuleListResponse |
| 400 | The request breaks a rule the detail names | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 409 | The object already exists or is in a state that does not allow this change | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
rules | array of OnlineEvalRuleView | Yes | Rules |
total | integer | Yes | Total |
page | integer | Yes | Page |
page_size | integer | Yes | Page Size |
POST /eval/online/rules
Create an online scoring rule
A rule that scores sample_percentage percent of the live requests its match selects, after the response went back to the caller. Scorers must need only the request and its reply. A judged scorer bills its judge calls to you as online eval spend, up to daily_judge_budget a day. A remote scorer is pinned to its registered revision, must read nothing but the request and its reply, and gets each request only while its data policies and region allow it to leave the gateway or the scorer is self-hosted. Only a proxy admin may create a rule. The rule is written to the audit log and every gateway pod starts using it within 30 seconds.
Request body (application/json, schema NewOnlineEvalRule):
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Name |
description | string or null | No | Description |
enabled | boolean | No | Enabled |
match | OnlineRuleMatch | No | Which requests a rule sees. Values within one field are alternatives, the fields must all match, and an |
sample_percentage | number | Yes | Sample Percentage |
scorers | array of object | Yes | Scorers |
daily_judge_budget | number or null | No | Daily Judge Budget |
daily_remote_call_cap | integer or null | No | Daily Remote Call Cap |
alert | OnlineEvalAlert | No | When a rule raises an eval_regression alert: a (model group, scorer) pass rate under min_pass_rate, |
Example request:
curl -X POST "http://localhost:4000/eval/online/rules" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "support refunds",
"match": {
"tags": [
"support"
]
},
"sample_percentage": 5,
"scorers": [
{
"type": "contains",
"substrings": [
"refund"
]
}
]
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json Spanway_OnlineEvalRuleTable |
| 400 | The request breaks a rule the detail names | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 409 | The object already exists or is in a state that does not allow this change | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
rule_id | string | Yes | Rule Id |
name | string | Yes | Name |
description | string or null | No | Description |
enabled | boolean | Yes | Enabled |
model_groups | array of string | No | Model Groups |
team_ids | array of string | No | Team Ids |
keys | array of string | No | Keys |
tags | array of string | No | Tags |
sample_percentage | number | Yes | Sample Percentage |
scorers | array of object | Yes | Scorers |
daily_judge_budget | number or null | No | Daily Judge Budget |
daily_remote_call_cap | integer or null | No | Daily Remote Call Cap |
alert | OnlineEvalAlert | No | When a rule raises an eval_regression alert: a (model group, scorer) pass rate under min_pass_rate, |
last_alerted_at | string or null | No | Last Alerted At |
created_by | string or null | No | Created By |
updated_by | string or null | No | Updated By |
created_at | string or null | No | Created At |
updated_at | string or null | No | Updated At |
version | integer | No | Version |
GET /eval/online/rules/{rule_id}
Read one online scoring rule
Return one online eval rule together with today's sampling counts. Only a proxy admin or an admin viewer may call it. Nothing is changed.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
rule_id | path | string | Yes |
Example request:
curl -X GET "http://localhost:4000/eval/online/rules/rule_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json OnlineEvalRuleView |
| 400 | The request breaks a rule the detail names | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 409 | The object already exists or is in a state that does not allow this change | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
rule | Spanway_OnlineEvalRuleTable | Yes | |
today | OnlineFunnel | Yes | What happened to the requests a rule matched on one UTC day. Counters lag one spend flush. |
PATCH /eval/online/rules/{rule_id}
Change an online scoring rule
Changes only the fields sent. scorers may only grow: send every existing scorer in its position with the same type (its config may change), then any new ones. Every change saves a new version of the rule, which can be restored later. Other pods pick the change up within 30 seconds. Only a proxy admin may call it. The before and after values are written to the audit log.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
rule_id | path | string | Yes |
Request body (application/json, schema UpdateOnlineEvalRule):
| Field | Type | Required | Description |
|---|---|---|---|
name | string or null | No | Name |
description | string or null | No | Description |
enabled | boolean or null | No | Enabled |
match | OnlineRuleMatch or null | No | |
sample_percentage | number or null | No | Sample Percentage |
scorers | array of object or null | No | Scorers |
daily_judge_budget | number or null | No | Daily Judge Budget |
daily_remote_call_cap | integer or null | No | Daily Remote Call Cap |
alert | OnlineEvalAlert or null | No |
Example request:
curl -X PATCH "http://localhost:4000/eval/online/rules/rule_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"enabled": false,
"sample_percentage": 2
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json Spanway_OnlineEvalRuleTable |
| 400 | The request breaks a rule the detail names | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 409 | The object already exists or is in a state that does not allow this change | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
rule_id | string | Yes | Rule Id |
name | string | Yes | Name |
description | string or null | No | Description |
enabled | boolean | Yes | Enabled |
model_groups | array of string | No | Model Groups |
team_ids | array of string | No | Team Ids |
keys | array of string | No | Keys |
tags | array of string | No | Tags |
sample_percentage | number | Yes | Sample Percentage |
scorers | array of object | Yes | Scorers |
daily_judge_budget | number or null | No | Daily Judge Budget |
daily_remote_call_cap | integer or null | No | Daily Remote Call Cap |
alert | OnlineEvalAlert | No | When a rule raises an eval_regression alert: a (model group, scorer) pass rate under min_pass_rate, |
last_alerted_at | string or null | No | Last Alerted At |
created_by | string or null | No | Created By |
updated_by | string or null | No | Updated By |
created_at | string or null | No | Created At |
updated_at | string or null | No | Updated At |
version | integer | No | Version |
DELETE /eval/online/rules/{rule_id}
Delete an online scoring rule
Deletes the rule and its funnel and answers with the rule as it was. Its scores stop being listed and are removed by score retention. Only a proxy admin may call it. The deletion is written to the audit log.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
rule_id | path | string | Yes |
Example request:
curl -X DELETE "http://localhost:4000/eval/online/rules/rule_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json Spanway_OnlineEvalRuleTable |
| 400 | The request breaks a rule the detail names | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 409 | The object already exists or is in a state that does not allow this change | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
rule_id | string | Yes | Rule Id |
name | string | Yes | Name |
description | string or null | No | Description |
enabled | boolean | Yes | Enabled |
model_groups | array of string | No | Model Groups |
team_ids | array of string | No | Team Ids |
keys | array of string | No | Keys |
tags | array of string | No | Tags |
sample_percentage | number | Yes | Sample Percentage |
scorers | array of object | Yes | Scorers |
daily_judge_budget | number or null | No | Daily Judge Budget |
daily_remote_call_cap | integer or null | No | Daily Remote Call Cap |
alert | OnlineEvalAlert | No | When a rule raises an eval_regression alert: a (model group, scorer) pass rate under min_pass_rate, |
last_alerted_at | string or null | No | Last Alerted At |
created_by | string or null | No | Created By |
updated_by | string or null | No | Updated By |
created_at | string or null | No | Created At |
updated_at | string or null | No | Updated At |
version | integer | No | Version |
GET /eval/online/scores
List the scores online rules gave to requests
Score rows newest first, for one request (the log drawer) or filtered. Rows of deleted rules are left out.
A proxy admin or an admin viewer sees every score. Anyone else needs a role with evals.read and sees only the
scores of their key's team, and an organization admin is refused. Nothing is changed.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
request_id | query | string or null | No | |
rule_id | query | string or null | No | |
model_group | query | string or null | No | |
scorer_index | query | integer or null | No | |
passed | query | boolean or null | No | |
start | query | string or null | No | |
end | query | string or null | No | |
page_size | query | integer | No |
Example request:
curl -X GET "http://localhost:4000/eval/online/scores" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json OnlineEvalScoreListResponse |
| 400 | The request breaks a rule the detail names | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 409 | The object already exists or is in a state that does not allow this change | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
scores | array of Spanway_OnlineEvalScoreTable | Yes | Scores |
GET /eval/online/summary
Summarize online scores per hour or day
Mean score, pass rate, error count and judge cost per hour or day for every (rule, model group, scorer). The span is capped at 31 days, and at 7 days for hour buckets. Only a proxy admin or an admin viewer may call it. Nothing is changed.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
start | query | string | Yes | |
end | query | string | Yes | |
bucket | query | enum: "hour", "day" | No | |
rule_id | query | string or null | No | |
model_group | query | string or null | No |
Example request:
curl -X GET "http://localhost:4000/eval/online/summary?start=string&end=string" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json OnlineScoreSummary |
| 400 | The request breaks a rule the detail names | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 409 | The object already exists or is in a state that does not allow this change | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
start | string | Yes | Start |
end | string | Yes | End |
bucket | enum: "hour", "day" | Yes | Bucket |
series | array of OnlineScoreSeries | Yes | Series |
POST /eval/online/rules/test
Try an online scoring rule before saving it
Runs every scorer of a rule on up to 10 samples exactly as live scoring would, and stores nothing, so you
can see the scores, the judge's reasons and the judge cost before the rule goes live. Samples are logged
requests (their stored prompt and answer), Lens traces, or questions and answers you type. For logged requests
the answer also says whether the rule's match selects each one and, with rule_id, whether live sampling picks
it. Judge calls are billed to your key and stop once the test spent max_judge_cost. Only proxy admins may
call it, and each test is written to the audit log.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/evaluator_operations#test-a-rule-before-you-save-it)
Request body (application/json, schema OnlineRuleTest):
| Field | Type | Required | Description |
|---|---|---|---|
rule_id | string or null | No | A saved rule, to report its sampling decisions |
match | OnlineRuleMatch | No | Which requests the rule would see |
sample_percentage | number | No | The share of matching requests scored |
scorers | array of object | Yes | The scorers to try, 1 to 5 |
samples | LoggedRequestSamples or LensTraceSamples or TypedSamples | Yes | What to score: logged requests, Lens traces or typed items |
max_judge_cost | number | No | Stop judge calls once the test spent this much, in US dollars |
Example request:
curl -X POST "http://localhost:4000/eval/online/rules/test" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"scorers": [
{
"type": "contains",
"substrings": [
"refund"
]
}
],
"samples": {
"type": "items",
"items": [
{
"input": "Can I get my money back?",
"output": "Yes, a refund is due."
}
]
}
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json OnlineRuleTestResult |
| 400 | A scorer, the match or the samples cannot be used | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 404 | No rule with that id | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
samples | array of OnlineTestSample | Yes | The scored samples |
skipped | array of OnlineTestSkipped | Yes | Samples that could not be scored |
judge_cost | number | Yes | What the test's judge calls cost in all, in US dollars |
judge_cost_per_request | number or null | Yes | Mean judge cost per scored sample |
POST /eval/online/rules/cost_preview
Preview what an online scoring rule will cost
Estimates how many requests a rule would score each day and what its judge calls would cost, from the
matching traffic of the last lookback_days days, so you can pick a sampling percentage and a daily budget
before turning the rule on. The judge cost per request is the one you measured with a test when you send
judge_cost_per_request, otherwise an estimate from the judge model's price and the traffic's mean token
counts. Nothing is stored and no model is called. Only proxy admins may call it.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/evaluator_operations#preview-the-cost)
Request body (application/json, schema OnlineCostPreviewRequest):
| Field | Type | Required | Description |
|---|---|---|---|
match | OnlineRuleMatch | No | Which requests the rule would see |
sample_percentage | number | Yes | The share of matching requests scored |
scorers | array of object | Yes | The scorers, 1 to 5 |
daily_judge_budget | number or null | No | The daily judge spend cap |
lookback_days | integer | No | Days of traffic to read |
judge_cost_per_request | number or null | No | A measured judge cost per request, from a test |
Example request:
curl -X POST "http://localhost:4000/eval/online/rules/cost_preview" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"match": {
"tags": [
"support"
]
},
"sample_percentage": 5,
"scorers": [
{
"type": "toxicity",
"judge_model": "gpt-5.5-mini"
}
],
"daily_judge_budget": 2,
"lookback_days": 7
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json OnlineCostPreview |
| 400 | A scorer or the match cannot be used | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
lookback_days | integer | Yes | Days of traffic read |
matched_requests | integer | Yes | Requests the rule's match selected in that window |
matched_per_day | number | Yes | Matching requests per day |
sampled_per_day | number | Yes | Expected requests scored per day before the budget |
avg_prompt_tokens | number | Yes | Mean prompt tokens of the matching requests |
avg_completion_tokens | number | Yes | Mean answer tokens of the matching requests |
scorers | array of OnlineScorerCost | Yes | The estimate per scorer |
basis | enum: "measured", "token_estimate", "unpriced", "no_judge" | Yes | Where the judge cost per request comes from |
judge_cost_per_request | number or null | Yes | Judge cost per scored request |
judge_cost_per_day | number or null | Yes | Expected judge spend per day before the budget |
daily_judge_budget | number or null | Yes | The daily cap sent |
budget_binding | boolean | Yes | Whether the budget would stop scoring before the day ends |
scored_per_day_within_budget | number or null | Yes | Requests a day the budget pays for |
GET /eval/online/rules/{rule_id}/sampling
Explain whether a rule samples a request
Says whether a rule picks one request and why. Sampling hashes the rule id with the request id, so a request always gets the same answer on every gateway pod and on every retry, and a backfill with sampling on picks the same requests. Proxy admins and admin viewers may call it. Nothing is changed.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/evaluator_operations#check-why-a-request-was-or-was-not-scored)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
rule_id | path | string | Yes | |
request_id | query | string | Yes |
Example request:
curl -X GET "http://localhost:4000/eval/online/rules/rule_id-123/sampling?request_id=request_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json OnlineSamplingCheck |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 404 | No rule with that id | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
rule_id | string | Yes | The rule |
request_id | string | Yes | The request |
sample_percentage | number | Yes | The rule's sampling percentage |
position | number | Yes | Where the request falls from 0 to 100, sampled when below the percentage |
sampled | boolean | Yes | Whether sampling picks the request |
found | boolean | Yes | Whether the request is in the spend logs |
matched | boolean or null | Yes | Whether the rule's match selects it, empty when not found |
scored | boolean | Yes | Whether the rule stored a score for it |
explanation | string | Yes | The answer in plain words |
GET /eval/online/rules/{rule_id}/versions
List the saved versions of an online scoring rule
Every saved version of a rule, newest first. A version is saved each time the rule is created, changed or restored, with the judge model, criteria, thresholds, match, sampling and budgets it had. Proxy admins and admin viewers may call it. Nothing is changed.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/evaluator_operations#versions-and-restore)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
rule_id | path | string | Yes |
Example request:
curl -X GET "http://localhost:4000/eval/online/rules/rule_id-123/versions" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json OnlineRuleVersionList |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 404 | No rule with that id | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
rule_id | string | Yes | The rule |
current_version | integer | Yes | The version the rule runs now |
versions | array of Spanway_OnlineEvalRuleVersionTable | Yes | Saved versions, newest first |
POST /eval/online/rules/{rule_id}/versions/{version}/restore
Restore a saved version of an online scoring rule
Puts a saved version's settings back on the rule and saves that as a new version, so the restore itself can be undone. Scores are kept by scorer position, so scorers added after that version stay on the rule, and the rule stays on or off as it is now. The saved settings are checked again first: a judge model that is no longer served or a remote scorer that was removed refuses the restore. Only proxy admins may call it. The before and after values are written to the audit log, and every gateway pod uses the restored rule within 30 seconds.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/evaluator_operations#versions-and-restore)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
rule_id | path | string | Yes | |
version | path | integer | Yes |
Request body (application/json, OnlineChangeReason or null):
Example request:
curl -X POST "http://localhost:4000/eval/online/rules/rule_id-123/versions/version-123/restore" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"reason": "version 3'\''s judge model fails too many polite answers"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json Spanway_OnlineEvalRuleTable |
| 400 | The saved version cannot run any more | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 404 | No rule or no saved version with that number | application/json ErrorDetail |
| 409 | Another rule took the saved version's name since | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
rule_id | string | Yes | Rule Id |
name | string | Yes | Name |
description | string or null | No | Description |
enabled | boolean | Yes | Enabled |
model_groups | array of string | No | Model Groups |
team_ids | array of string | No | Team Ids |
keys | array of string | No | Keys |
tags | array of string | No | Tags |
sample_percentage | number | Yes | Sample Percentage |
scorers | array of object | Yes | Scorers |
daily_judge_budget | number or null | No | Daily Judge Budget |
daily_remote_call_cap | integer or null | No | Daily Remote Call Cap |
alert | OnlineEvalAlert | No | When a rule raises an eval_regression alert: a (model group, scorer) pass rate under min_pass_rate, |
last_alerted_at | string or null | No | Last Alerted At |
created_by | string or null | No | Created By |
updated_by | string or null | No | Updated By |
created_at | string or null | No | Created At |
updated_at | string or null | No | Updated At |
version | integer | No | Version |
GET /eval/online/rules/{rule_id}/agreement
Compare an online scoring rule with human reviewers
Shows how often the rule's stored verdicts agree with human reviewers on the same requests, so you know
whether its judge can be trusted and where to set its threshold. Reviewers label production requests in a
review queue, and every request the rule also scored is compared: agreement, Cohen's kappa, the confusion
counts, the mean score error and a suggested threshold, for each scorer and rule version on its own. With
version only that version's verdicts count. Fewer than 30 compared items is flagged as low_sample. Proxy
admins and admin viewers may call it. Nothing is changed.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/evaluator_operations#judge-versus-human-agreement)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
rule_id | path | string | Yes | |
queue_id | query | string | Yes | |
version | query | integer or null | No |
Example request:
curl -X GET "http://localhost:4000/eval/online/rules/rule_id-123/agreement?queue_id=queue_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json OnlineRuleAgreement |
| 400 | No request in the queue was scored by the rule | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 404 | No rule or no review queue with that id | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
rule_id | string | Yes | The rule |
queue_id | string | Yes | The review queue the human labels come from |
compared_requests | integer | Yes | Requests both the rule and the reviewers judged |
calibration | CalibrationReport | Yes | Agreement, kappa and a suggested threshold per series |
GET /eval/online/rules/{rule_id}/backfills
List the backfills of an online scoring rule
The rule's 50 newest backfills with their progress: requests read, picked, scored, skipped because they were already scored or had no stored prompt and answer, skipped over budget, errors and judge spend. A backfill that still says running but has been silent for 10 minutes is flagged as interrupted. Proxy admins and admin viewers may call it. Nothing is changed.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/evaluator_operations#backfill-past-traffic)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
rule_id | path | string | Yes |
Example request:
curl -X GET "http://localhost:4000/eval/online/rules/rule_id-123/backfills" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json OnlineBackfillList |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 404 | No rule with that id | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
backfills | array of OnlineBackfillView | Yes | The rule's backfills, newest first |
POST /eval/online/rules/{rule_id}/backfills
Score past traffic with an online scoring rule
Scores past traffic with a saved rule in the background, so a new or changed rule has history to chart and
compare from day one. The source is logged requests in a time window of at most 31 days that the rule's match
selects (newest first, up to 20,000 read), or up to 200 Lens traces you pick. With apply_sampling only the
requests live sampling would have picked are scored. Requests the rule already scored are skipped, so running
it again is safe. Judge calls are billed like live scoring and stop once the backfill spent judge_budget.
Scores land with the original request time and the rule version. One backfill per rule runs at a time. Only
proxy admins may call it, and the start is written to the audit log.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/evaluator_operations#backfill-past-traffic)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
rule_id | path | string | Yes |
Request body (application/json, schema NewOnlineBackfill):
| Field | Type | Required | Description |
|---|---|---|---|
source | SpendLogBackfillSource or LensBackfillSource | Yes | Logged requests in a time window, or Lens traces |
max_requests | integer | No | The most requests to score, at most 500 |
apply_sampling | boolean | No | Score only the requests live sampling would pick |
judge_budget | number or null | No | The most this backfill may spend on judges |
Example request:
curl -X POST "http://localhost:4000/eval/online/rules/rule_id-123/backfills" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"source": {
"type": "spend_logs",
"start": "2026-11-14T00:00:00Z",
"end": "2026-11-21T00:00:00Z"
},
"max_requests": 100,
"apply_sampling": true
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json Spanway_OnlineEvalBackfillTable |
| 400 | The rule or the source cannot be backfilled | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 404 | No rule with that id | application/json ErrorDetail |
| 409 | A backfill of the rule is already running | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
backfill_id | string | Yes | The id of the backfill |
rule_id | string | Yes | The rule that scores |
rule_version | integer | Yes | The rule version used |
source | SpendLogBackfillSource or LensBackfillSource | Yes | What was scored |
apply_sampling | boolean | Yes | Whether only requests live sampling picks were scored |
max_requests | integer | Yes | The most requests to score |
judge_budget | number or null | No | The judge spend cap |
status | enum: "running", "completed", "failed", "cancelled" | Yes | running, completed, failed or cancelled |
scanned | integer | No | Requests or traces read |
selected | integer | No | Of those, the ones picked for scoring |
scored | integer | No | Requests scored |
already_scored | integer | No | Requests skipped because the rule already scored them |
unreadable | integer | No | Requests skipped because no prompt and answer were kept |
over_budget | integer | No | Requests skipped once the judge budget ran out |
errors | integer | No | Scorer results that are errors |
judge_spend | number | No | What the judge calls cost, in US dollars |
error | string or null | No | Why the backfill failed |
created_by | string or null | No | Who started it |
created_at | string or null | No | When it started |
updated_at | string or null | No | When its counters last moved |
finished_at | string or null | No | When it ended |
GET /eval/online/rules/{rule_id}/backfills/{backfill_id}
Read one backfill of an online scoring rule
One backfill with its progress. Proxy admins and admin viewers may call it. Nothing is changed.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/evaluator_operations#backfill-past-traffic)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
rule_id | path | string | Yes | |
backfill_id | path | string | Yes |
Example request:
curl -X GET "http://localhost:4000/eval/online/rules/rule_id-123/backfills/backfill_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json OnlineBackfillView |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 404 | No rule or no backfill of it with that id | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
backfill | Spanway_OnlineEvalBackfillTable | Yes | The backfill |
interrupted | boolean | Yes | Running but silent for 10 minutes, so its gateway pod likely stopped |
POST /eval/online/rules/{rule_id}/backfills/{backfill_id}/cancel
Cancel a running backfill
Stops a running backfill after the request it is scoring now. Scores already written stay. Only proxy admins may call it, and the cancel is written to the audit log.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/evaluator_operations#backfill-past-traffic)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
rule_id | path | string | Yes | |
backfill_id | path | string | Yes |
Request body (application/json, OnlineChangeReason or null):
Example request:
curl -X POST "http://localhost:4000/eval/online/rules/rule_id-123/backfills/backfill_id-123/cancel" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"reason": "wrong time window"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json Spanway_OnlineEvalBackfillTable |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 404 | No rule or no backfill of it with that id | application/json ErrorDetail |
| 409 | The backfill already ended | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
backfill_id | string | Yes | The id of the backfill |
rule_id | string | Yes | The rule that scores |
rule_version | integer | Yes | The rule version used |
source | SpendLogBackfillSource or LensBackfillSource | Yes | What was scored |
apply_sampling | boolean | Yes | Whether only requests live sampling picks were scored |
max_requests | integer | Yes | The most requests to score |
judge_budget | number or null | No | The judge spend cap |
status | enum: "running", "completed", "failed", "cancelled" | Yes | running, completed, failed or cancelled |
scanned | integer | No | Requests or traces read |
selected | integer | No | Of those, the ones picked for scoring |
scored | integer | No | Requests scored |
already_scored | integer | No | Requests skipped because the rule already scored them |
unreadable | integer | No | Requests skipped because no prompt and answer were kept |
over_budget | integer | No | Requests skipped once the judge budget ran out |
errors | integer | No | Scorer results that are errors |
judge_spend | number | No | What the judge calls cost, in US dollars |
error | string or null | No | Why the backfill failed |
created_by | string or null | No | Who started it |
created_at | string or null | No | When it started |
updated_at | string or null | No | When its counters last moved |
finished_at | string or null | No | When it ended |
GET /eval/review/queues
List review queues
Lists the human review queues, a page at a time, each with how many items are pending, labelled and in total. Proxy admins, admin viewers and custom roles with evals.read may call it, each seeing only the queues its team or organization owns. It changes nothing.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/review_queues#queues)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
page | query | integer | No | |
page_size | query | integer | No |
Example request:
curl -X GET "http://localhost:4000/eval/review/queues" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | One page of queues with their counts | application/json ReviewQueueListResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The license lacks the evals feature, or the caller's role may not read review queues | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
queues | array of ReviewQueueView | Yes | Queues |
total | integer | Yes | Total |
page | integer | Yes | Page |
page_size | integer | Yes | Page Size |
POST /eval/review/queues
Create a review queue
Creates a human review queue, a list of model answers that the people you name label as pass or fail, so you
can check what automated scorers miss and calibrate them. Reviewers must be internal users or proxy admins.
labels_per_item sets how many reviewers label each item before it counts as decided. The new queue is
written to the audit log. Proxy admins and custom roles with evals.write may call it, and it needs the evals
license feature.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/review_queues#queues)
Request body (application/json, schema NewReviewQueue):
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Queue name, unique per owner |
description | string or null | No | What the queue is for |
instructions | string or null | No | What reviewers should check, shown on every item |
reviewers | array of string | No | User ids of the internal users or proxy admins who label the items |
labels_per_item | integer | No | How many reviewers must label an item before it counts as decided |
score_enabled | boolean | No | Let reviewers give a score from 0 to 1 besides pass or fail |
blind | boolean | No | Hide the expected answer and give each reviewer the items in their own order |
Example request:
curl -X POST "http://localhost:4000/eval/review/queues" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "support answers",
"description": "Weekly check of refund answers",
"instructions": "Pass when the answer states the 14 day refund window and nothing false.",
"reviewers": [
"reviewer-1@example.com",
"reviewer-2@example.com"
],
"labels_per_item": 2,
"score_enabled": true
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The new queue | application/json Spanway_EvalReviewQueueTable |
| 400 | A reviewer does not exist or may not review | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The license lacks the evals feature, or the caller may not change review queues | application/json ErrorDetail |
| 409 | The owner already has a queue with this name | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
queue_id | string | Yes | Queue Id |
name | string | Yes | Name |
description | string or null | No | Description |
instructions | string or null | No | Instructions |
reviewers | array of string | No | Reviewers |
labels_per_item | integer | No | Labels Per Item |
score_enabled | boolean | No | Score Enabled |
blind | boolean | No | Blind |
created_by | string or null | No | Created By |
owner_team_id | string or null | No | Owner Team Id |
owner_org_id | string or null | No | Owner Org Id |
created_at | string or null | No | Created At |
updated_at | string or null | No | Updated At |
GET /eval/review/queues/{queue_id}
Get a review queue
Shows one human review queue with its reviewers, instructions and item counts. It answers 404 when the id is unknown or outside the caller's scope. Proxy admins, admin viewers and custom roles with evals.read may call it, each seeing only the queues its team or organization owns. It changes nothing.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/review_queues#queues)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
queue_id | path | string | Yes |
Example request:
curl -X GET "http://localhost:4000/eval/review/queues/queue_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The queue with its counts | application/json ReviewQueueView |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The license lacks the evals feature, or the caller's role may not read review queues | application/json ErrorDetail |
| 404 | No queue has this id within the caller's scope | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
queue | Spanway_EvalReviewQueueTable | Yes | The queue |
pending | integer | Yes | Items that still need labels |
labelled | integer | Yes | Items with all the labels they need |
total | integer | Yes | All items in the queue |
PATCH /eval/review/queues/{queue_id}
Change a review queue
Changes only the fields you send. Removing a reviewer takes away their access at once. Lowering
labels_per_item marks items that already have enough labels as decided. The change is written to the audit
log with the values before and after. Proxy admins and custom roles with evals.write may call it, and it
needs the evals license feature.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/review_queues#queues)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
queue_id | path | string | Yes |
Request body (application/json, schema UpdateReviewQueue):
| Field | Type | Required | Description |
|---|---|---|---|
name | string or null | No | New queue name |
description | string or null | No | What the queue is for |
instructions | string or null | No | What reviewers should check, shown on every item |
reviewers | array of string or null | No | The full new reviewer list, removed reviewers lose access at once |
labels_per_item | integer or null | No | How many reviewers must label an item before it counts as decided |
score_enabled | boolean or null | No | Let reviewers give a score from 0 to 1 besides pass or fail |
blind | boolean or null | No | Hide the expected answer and give each reviewer the items in their own order |
Example request:
curl -X PATCH "http://localhost:4000/eval/review/queues/queue_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"labels_per_item": 1,
"reviewers": [
"reviewer-1@example.com"
]
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The queue as changed | application/json Spanway_EvalReviewQueueTable |
| 400 | Nothing was sent, or a reviewer may not review | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The license lacks the evals feature, or the caller may not change review queues | application/json ErrorDetail |
| 404 | No queue has this id within the caller's scope | application/json ErrorDetail |
| 409 | The owner already has a queue with this name | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
queue_id | string | Yes | Queue Id |
name | string | Yes | Name |
description | string or null | No | Description |
instructions | string or null | No | Instructions |
reviewers | array of string | No | Reviewers |
labels_per_item | integer | No | Labels Per Item |
score_enabled | boolean | No | Score Enabled |
blind | boolean | No | Blind |
created_by | string or null | No | Created By |
owner_team_id | string or null | No | Owner Team Id |
owner_org_id | string or null | No | Owner Org Id |
created_at | string or null | No | Created At |
updated_at | string or null | No | Updated At |
DELETE /eval/review/queues/{queue_id}
Delete a review queue
Deletes the queue with every item and label in it, for good. Datasets already exported from it keep their items. The deletion is written to the audit log. Proxy admins and custom roles with evals.write may call it, and it needs the evals license feature.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/review_queues#queues)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
queue_id | path | string | Yes |
Example request:
curl -X DELETE "http://localhost:4000/eval/review/queues/queue_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The deleted queue | application/json Spanway_EvalReviewQueueTable |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The license lacks the evals feature, or the caller may not change review queues | application/json ErrorDetail |
| 404 | No queue has this id within the caller's scope | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
queue_id | string | Yes | Queue Id |
name | string | Yes | Name |
description | string or null | No | Description |
instructions | string or null | No | Instructions |
reviewers | array of string | No | Reviewers |
labels_per_item | integer | No | Labels Per Item |
score_enabled | boolean | No | Score Enabled |
blind | boolean | No | Blind |
created_by | string or null | No | Created By |
owner_team_id | string or null | No | Owner Team Id |
owner_org_id | string or null | No | Owner Org Id |
created_at | string or null | No | Created At |
updated_at | string or null | No | Updated At |
POST /eval/review/queues/{queue_id}/from_run
Add eval run results to a review queue
Adds results of a completed eval run to the queue, by default the failed ones, keeping the scorer's verdict so the calibration report can compare it with the human labels. Errored and unscored results are skipped, and a result already in the queue is added once. Each fill is written to the audit log with its counts. Proxy admins and custom roles with evals.write may call it, and it needs the evals license feature.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/review_queues#filling-a-queue)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
queue_id | path | string | Yes |
Request body (application/json, schema EnqueueFromRun):
| Field | Type | Required | Description |
|---|---|---|---|
run_id | string | Yes | The completed eval run to take results from |
filter | enum: "all", "passed", "failed" | No | Which results to take: failed (default), passed or all |
model | string or null | No | Take only the results of this model |
sample | LogSample | No | How many results to take and how to pick them |
Example request:
curl -X POST "http://localhost:4000/eval/review/queues/queue_id-123/from_run" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"run_id": "run_9d02e5f7",
"filter": "failed",
"sample": {
"size": 25,
"strategy": "random"
}
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | How many items were added and why others were left out | application/json EnqueueResult |
| 400 | The run is not completed, or the queue would hold too many items | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The license lacks the evals feature, or the caller may not change review queues | application/json ErrorDetail |
| 404 | The queue or the run does not exist | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
added | integer | Yes | Items added to the queue |
duplicates | integer | Yes | Items left out because the queue already holds them |
skipped_no_content | integer | No | Sources left out because they have no stored response |
skipped_redacted | integer | No | Sources left out because their content was redacted |
skipped_missing_item | integer | No | Results left out because their dataset item no longer exists |
skipped_data_policy | integer | No | Requests left out because their key, team or org requires zero retention |
POST /eval/review/queues/{queue_id}/from_logs
Add sampled production responses to a review queue
Adds a sample of real production answers from the request logs to the queue, so people can judge live
traffic. It needs general_settings.store_prompts_in_spend_logs. Requests whose key, team or organization
requires zero data retention, and redacted requests, are left out. Each fill is written to the audit log with
its counts. Only proxy admins may call it, because it copies request bodies of every team.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/review_queues#filling-a-queue)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
queue_id | path | string | Yes |
Request body (application/json, schema EnqueueFromLogs):
| Field | Type | Required | Description |
|---|---|---|---|
filters | LogFilters | Yes | Which logged requests to sample from, start and end are required |
sample | LogSample | No | How many requests to take and how to pick them |
Example request:
curl -X POST "http://localhost:4000/eval/review/queues/queue_id-123/from_logs" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"filters": {
"start": "2026-11-14T00:00:00Z",
"end": "2026-11-21T00:00:00Z",
"models": [
"claude-sonnet-5-5"
],
"teams": [
"team-support"
]
},
"sample": {
"size": 50,
"strategy": "random"
}
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | How many items were added and why others were left out | application/json EnqueueResult |
| 400 | Nothing matched, or the queue would hold too many items | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The license lacks the evals feature, or the caller is not a proxy admin | application/json ErrorDetail |
| 404 | No queue has this id within the caller's scope | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
added | integer | Yes | Items added to the queue |
duplicates | integer | Yes | Items left out because the queue already holds them |
skipped_no_content | integer | No | Sources left out because they have no stored response |
skipped_redacted | integer | No | Sources left out because their content was redacted |
skipped_missing_item | integer | No | Results left out because their dataset item no longer exists |
skipped_data_policy | integer | No | Requests left out because their key, team or org requires zero retention |
POST /eval/review/queues/{queue_id}/from_shadow
Add shadowed requests to a review queue
Adds the real answers of shadowed requests to the queue, one item per request, so people can judge whether the model in production answered acceptably while a candidate model ran in the shadow. The judge's preference is kept in the item metadata for admins and never shown to reviewers. Each fill is written to the audit log with its counts. Only proxy admins may call it, because it copies request bodies of every team.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/review_queues#filling-a-queue)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
queue_id | path | string | Yes |
Request body (application/json, schema EnqueueFromShadow):
| Field | Type | Required | Description |
|---|---|---|---|
job_id | string or null | No | Take only the attempts of this shadow job |
model | string or null | No | Take only the attempts of this shadow model |
start | string or null | No | Earliest attempt time |
end | string or null | No | Latest attempt time |
outcome | enum: "real", "shadow", "tie" or null | No | Take only attempts where the judge preferred real, shadow, or saw a tie |
sample | LogSample | No | How many attempts to take and how to pick them |
Example request:
curl -X POST "http://localhost:4000/eval/review/queues/queue_id-123/from_shadow" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"job_id": "shadow_2c71",
"start": "2026-11-14T00:00:00Z",
"end": "2026-11-21T00:00:00Z",
"outcome": "shadow",
"sample": {
"size": 50
}
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | How many items were added and why others were left out | application/json EnqueueResult |
| 400 | Nothing matched, or the queue would hold too many items | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The license lacks the evals feature, or the caller is not a proxy admin | application/json ErrorDetail |
| 404 | No queue has this id within the caller's scope | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
added | integer | Yes | Items added to the queue |
duplicates | integer | Yes | Items left out because the queue already holds them |
skipped_no_content | integer | No | Sources left out because they have no stored response |
skipped_redacted | integer | No | Sources left out because their content was redacted |
skipped_missing_item | integer | No | Results left out because their dataset item no longer exists |
skipped_data_policy | integer | No | Requests left out because their key, team or org requires zero retention |
GET /eval/review/queues/{queue_id}/items
List the items of a review queue
Lists the items of a queue, newest first, with every label, the consensus and the automated verdicts. Filter
with pending, source and reviewer. A caller let in only by a custom role sees the input and answer of
production and shadow items redacted. Proxy admins, admin viewers and custom roles with evals.read may call
it, each seeing only the queues its team or organization owns. It changes nothing.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/review_queues#who-can-do-what)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
queue_id | path | string | Yes | |
pending | query | boolean or null | No | |
source | query | enum: "eval_result", "production", "shadow" or null | No | |
reviewer | query | string or null | No | |
page | query | integer | No | |
page_size | query | integer | No |
Example request:
curl -X GET "http://localhost:4000/eval/review/queues/queue_id-123/items" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | One page of items with their labels and verdicts | application/json ReviewItemListResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The license lacks the evals feature, or the caller's role may not read review queues | application/json ErrorDetail |
| 404 | No queue has this id within the caller's scope | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
items | array of ReviewItemAdminView | Yes | Items |
total | integer | Yes | Total |
page | integer | Yes | Page |
page_size | integer | Yes | Page Size |
GET /eval/review/queues/{queue_id}/items/{review_item_id}
Get a review item with its labels
Shows one item of a queue with every label, the consensus and the automated verdicts, and the request id to open in the run ledger. A caller let in only by a custom role sees the input and answer of production and shadow items redacted. Proxy admins, admin viewers and custom roles with evals.read may call it, each seeing only the queues its team or organization owns. It changes nothing.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/review_queues#who-can-do-what)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
queue_id | path | string | Yes | |
review_item_id | path | string | Yes |
Example request:
curl -X GET "http://localhost:4000/eval/review/queues/queue_id-123/items/review_item_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The item with every label and verdict | application/json ReviewItemAdminView |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The license lacks the evals feature, or the caller's role may not read review queues | application/json ErrorDetail |
| 404 | No item has this id in the queue, or the caller does not hold it | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
item | Spanway_EvalReviewItemTable | Yes | The item with its content and automated verdicts |
labels | array of Spanway_EvalReviewLabelTable | Yes | Every reviewer's label |
consensus | ReviewConsensus | Yes | The majority label and the mean score |
pending | boolean | Yes | Whether the item still needs labels |
ledger_id | string or null | Yes | The request id to open in the run ledger, when the item came from a request |
DELETE /eval/review/queues/{queue_id}/items/{review_item_id}
Remove an item from a review queue
Removes one item and its labels from a queue, for example an item that should never have been added, and returns what was removed. The removal is written to the audit log without the item content. Proxy admins and custom roles with evals.write may call it, and it needs the evals license feature.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/review_queues#queues)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
queue_id | path | string | Yes | |
review_item_id | path | string | Yes |
Example request:
curl -X DELETE "http://localhost:4000/eval/review/queues/queue_id-123/items/review_item_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The removed item | application/json ReviewItemAdminView |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The license lacks the evals feature, or the caller may not change review queues | application/json ErrorDetail |
| 404 | No item has this id in the queue, or the caller does not hold it | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
item | Spanway_EvalReviewItemTable | Yes | The item with its content and automated verdicts |
labels | array of Spanway_EvalReviewLabelTable | Yes | Every reviewer's label |
consensus | ReviewConsensus | Yes | The majority label and the mean score |
pending | boolean | Yes | Whether the item still needs labels |
ledger_id | string or null | Yes | The request id to open in the run ledger, when the item came from a request |
GET /eval/review/queues/{queue_id}/calibration
Compare human labels with automated scorers
Shows how well each automated scorer agrees with the human reviewers, so you can tell whether a judge can be
trusted and where to set its threshold: agreement, Cohen's kappa, the confusion counts, the mean score error
and a suggested threshold for every scorer and model pair. Only items whose labels are all in and do not tie
count. Without run_id the verdicts stored when each item was added are compared. With run_id that run's
results for items exported from this queue are compared. Fewer than 30 items is flagged as low_sample.
Proxy admins, admin viewers and custom roles with evals.read may call it, each seeing only the queues its
team or organization owns. It changes nothing.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/review_queues#calibration)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
queue_id | path | string | Yes | |
run_id | query | string or null | No | |
model | query | string or null | No |
Example request:
curl -X GET "http://localhost:4000/eval/review/queues/queue_id-123/calibration" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | How well each scorer and model pair agrees with the reviewers | application/json CalibrationReport |
| 400 | The run has no result for any decided item of the queue | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The license lacks the evals feature, or the caller's role may not read review queues | application/json ErrorDetail |
| 404 | No queue has this id within the caller's scope | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
queue_id | string | Yes | The queue the labels come from |
run_id | string or null | Yes | The run whose verdicts were compared, empty for the verdicts stored at enqueue |
labelled_items | integer | Yes | Items with all the labels they need |
consensus_items | integer | Yes | Of those, items whose labels do not tie |
excluded_ties | integer | Yes | Items left out because reviewers tied |
inter_rater_agreement | number or null | Yes | How often reviewers agree with each other, from 0 to 1 |
metrics | array of MetricCalibration | Yes | Agreement between humans and each scorer and model pair |
POST /eval/review/queues/{queue_id}/to_dataset
Export decided review items as a golden dataset
Exports the decided items of a queue as a golden dataset for future eval runs, either a new dataset (name)
or appended to an existing one (dataset_id). With output_as_expected an item humans passed gets its
answer as the expected answer. Each item keeps its source request and subject ids in metadata, so a data
subject erasure also removes it from the dataset. Appending skips items the dataset already holds and is
refused while the dataset has runs in progress or enabled schedules. The export is written to the audit log.
Proxy admins and custom roles with evals.write may call it, and it needs the evals license feature.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/review_queues#golden-datasets)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
queue_id | path | string | Yes |
Request body (application/json, schema ReviewToDataset):
| Field | Type | Required | Description |
|---|---|---|---|
dataset_id | string or null | No | Append to this existing dataset, or send name instead |
name | string or null | No | Create a new dataset with this name, or send dataset_id instead |
description | string or null | No | Description of the new dataset |
include | enum: "passed", "failed", "all" | No | Which decided items to export: passed (default), failed or all |
output_as_expected | boolean | No | Use the response of an item humans passed as its expected answer |
Example request:
curl -X POST "http://localhost:4000/eval/review/queues/queue_id-123/to_dataset" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "refund golden",
"include": "passed",
"output_as_expected": true
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The dataset the items went to | application/json ReviewExportResult |
| 400 | No decided item matches include, or the dataset is busy or too large | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The license lacks the evals feature, or the caller may not change review queues | application/json ErrorDetail |
| 404 | No queue has this id within the caller's scope | application/json ErrorDetail |
| 409 | A dataset with this name exists | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
dataset_id | string | Yes | The dataset the items went to |
added | integer | Yes | Items added |
duplicates | integer | Yes | Items left out because the dataset already holds them |
item_count | integer | Yes | Items in the dataset now |
GET /eval/review/assigned
List the review queues assigned to you
Lists the review queues the caller is a reviewer of, with how many items are left for them, for the reviewer page of the Admin UI. Any signed-in internal user or proxy admin may call it, and a caller who reviews nothing gets an empty list. It changes nothing.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/review_queues#labelling)
Example request:
curl -X GET "http://localhost:4000/eval/review/assigned" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The queues the caller reviews | application/json AssignedQueueListResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The license lacks the evals feature, or the caller's role may not read review queues | application/json ErrorDetail |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
queues | array of AssignedQueue | Yes | Queues |
POST /eval/review/queues/{queue_id}/next
Claim the next item to review
Claims the next item of the queue for the caller for 30 minutes, or returns the one they already hold, so reloading the page resumes it. Two reviewers never get the same item at once. Items an admin assigned to the caller come first, and items assigned to another reviewer are left for them. The item is empty when nothing is left for the caller. What a reviewer sees is blind: no automated verdict, other labels, model or source. A blind queue also hides the expected answer and gives each reviewer the items in their own order. Only the internal users and proxy admins the queue names as reviewers may call it.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/review_queues#labelling)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
queue_id | path | string | Yes |
Request body (application/json, object):
Example request:
curl -X POST "http://localhost:4000/eval/review/queues/queue_id-123/next" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The claimed item, or an empty item when nothing is left | application/json ReviewNext |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The license lacks the evals feature, or the caller is not a reviewer of this queue | application/json ErrorDetail |
| 404 | No queue has this id within the caller's scope | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
item | ReviewItemReviewerView or null | Yes | The claimed item, empty when nothing is left for the caller |
GET /eval/review/items/{review_item_id}
Get an item you are reviewing
Shows an item the caller holds or has already labelled, as reviewers see it, with their own label. It answers 404 for any other item. It changes nothing. Only the internal users and proxy admins the queue names as reviewers may call it.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/review_queues#labelling)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
review_item_id | path | string | Yes |
Example request:
curl -X GET "http://localhost:4000/eval/review/items/review_item_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The item as reviewers see it | application/json ReviewItemReviewerView |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The license lacks the evals feature, or the caller is not a reviewer of this queue | application/json ErrorDetail |
| 404 | No item has this id in the queue, or the caller does not hold it | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
review_item_id | string | Yes | Id of the item |
queue_id | string | Yes | Id of the queue it belongs to |
instructions | string or null | Yes | What to check |
input | string or array of SystemMessage or UserMessage or AssistantMessage or ToolMessage | Yes | The prompt or conversation that was answered |
output | string or null | Yes | The response to judge |
expected | string or null | Yes | The expected answer, when the item has one and the queue is not blind |
context | array of string or null | Yes | Documents the answer should be based on, when the item has them |
score_enabled | boolean | Yes | Whether a score from 0 to 1 can be given besides pass or fail |
blind | boolean | Yes | Whether the queue hides the expected answer and shuffles the items |
own_label | OwnLabel or null | Yes | The caller's earlier label, when there is one |
lease_expires_at | string or null | Yes | When the caller's claim on the item runs out |
POST /eval/review/items/{review_item_id}/label
Label a review item
Labels an item the caller holds as pass or fail, with an optional score and comment, or changes the caller's earlier label, which still counts once. Labelling releases the claim. A first label without an unexpired claim answers 409. Labels are kept with the reviewer and the time, not in the audit log. Only the internal users and proxy admins the queue names as reviewers may call it.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/review_queues#labelling)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
review_item_id | path | string | Yes |
Request body (application/json, schema NewReviewLabel):
| Field | Type | Required | Description |
|---|---|---|---|
passed | boolean | Yes | Whether the response is acceptable |
score | number or null | No | A score from 0 to 1, only when the queue collects scores |
comment | string or null | No | Why, in a few words |
Example request:
curl -X POST "http://localhost:4000/eval/review/items/review_item_id-123/label" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"passed": true,
"score": 0.9,
"comment": "Correct window, clear wording"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The caller's label as stored | application/json OwnLabel |
| 400 | A score was sent to a queue that collects pass or fail only | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The license lacks the evals feature, or the caller is not a reviewer of this queue | application/json ErrorDetail |
| 404 | No item has this id in the queue, or the caller does not hold it | application/json ErrorDetail |
| 409 | The caller does not hold the item, so it cannot be labelled for the first time | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
passed | boolean | Yes | Whether the reviewer passed the response |
score | number or null | Yes | The reviewer's score from 0 to 1, when the queue collects scores |
comment | string or null | Yes | The reviewer's comment |
POST /eval/review/items/{review_item_id}/skip
Skip a review item
Hides an item from the caller for good, for an item they cannot judge, and releases their claim on it. Other reviewers still get it. Only the internal users and proxy admins the queue names as reviewers may call it.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/review_queues#labelling)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
review_item_id | path | string | Yes |
Request body (application/json, object):
Example request:
curl -X POST "http://localhost:4000/eval/review/items/review_item_id-123/skip" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The item the caller will no longer see | application/json ReviewSkipped |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The license lacks the evals feature, or the caller is not a reviewer of this queue | application/json ErrorDetail |
| 404 | No item has this id in the queue, or the caller does not hold it | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
review_item_id | string | Yes | Id of the item the caller will no longer see |
GET /eval/review/queues/{queue_id}/board
Show who is working on a review queue
Shows the assignment board of a queue: how many items are pending and how many nobody is assigned to, and for every reviewer how many items an admin assigned to them, how many they have open right now, how many they could still take, how many they labelled and skipped, and when they last labelled. Use it to spot a reviewer who is behind or away. Proxy admins, admin viewers and custom roles with evals.read may call it, each seeing only the queues its team or organization owns. It changes nothing.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/review_board#assignment-board)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
queue_id | path | string | Yes |
Example request:
curl -X GET "http://localhost:4000/eval/review/queues/queue_id-123/board" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Pending and unassigned counts with one row per reviewer | application/json ReviewBoard |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The license lacks the evals feature, or the caller's role may not read review queues | application/json ErrorDetail |
| 404 | No queue has this id within the caller's scope | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
queue_id | string | Yes | The queue |
pending | integer | Yes | Items that still need labels |
unassigned | integer | Yes | Pending items not assigned to any reviewer, open to every reviewer |
reviewers | array of ReviewerWorkload | Yes | One row per reviewer named on the queue |
POST /eval/review/queues/{queue_id}/assign
Assign review items to reviewers
Shares pending items out to reviewers of the queue, each item to the named reviewer who holds the fewest, so
the work is split evenly. Without review_item_ids it takes the oldest items nobody is assigned to or has
open, up to 1,000 per call. With them it assigns those items, moving them from another reviewer if needed. An
item a reviewer has open under a live 30 minute claim stays with them: it goes to them when they are named and
counts as not assignable otherwise. An assigned item is offered only to its reviewer until they label or skip
it or leave the queue. Decided items and items every named reviewer already labelled or skipped stay as they
were. The change is written to the audit log
with the assignments before and after. Proxy admins and custom roles with evals.write may call it.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/review_board#assigning-items)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
queue_id | path | string | Yes |
Request body (application/json, schema AssignReviewItems):
| Field | Type | Required | Description |
|---|---|---|---|
reviewers | array of string | Yes | Reviewers of the queue to share the items between, the least loaded first |
review_item_ids | array of string or null | No | The items to assign, or leave out to take the oldest unassigned pending items |
Example request:
curl -X POST "http://localhost:4000/eval/review/queues/queue_id-123/assign" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"reviewers": [
"reviewer-1@example.com",
"reviewer-2@example.com"
]
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | How many items each reviewer was given | application/json AssignResult |
| 400 | A named user is not a reviewer of the queue | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The license lacks the evals feature, or the caller may not change review queues | application/json ErrorDetail |
| 404 | The queue does not exist in the caller's scope, or an item id is not in it | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
assigned | integer | Yes | Items assigned |
not_assignable | integer | Yes | Items left as they were, already decided or labelled or skipped by every reviewer named |
by_reviewer | object | Yes | How many items each reviewer was given |
POST /eval/review/queues/{queue_id}/unassign
Take review items back from reviewers
Takes pending items back so any reviewer of the queue can pick them up, for example from a reviewer who is
away. It removes the admin assignment and any open claim on each item, so a reviewer who was still working
on one gets a 409 when they label it and claims the next item instead. Send reviewer to take back what one
reviewer holds, review_item_ids for chosen items, or both. Labels already given stay. The change is written
to the audit log with who held each item. Proxy admins and custom roles with evals.write may call it.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/review_board#taking-items-back)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
queue_id | path | string | Yes |
Request body (application/json, schema UnassignReviewItems):
| Field | Type | Required | Description |
|---|---|---|---|
review_item_ids | array of string or null | No | The items to take back, or leave out to take back every item of the reviewer |
reviewer | string or null | No | Take back only what this reviewer holds |
Example request:
curl -X POST "http://localhost:4000/eval/review/queues/queue_id-123/unassign" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"reviewer": "reviewer-1@example.com"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | How many items were taken back | application/json UnassignResult |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The license lacks the evals feature, or the caller may not change review queues | application/json ErrorDetail |
| 404 | The queue does not exist in the caller's scope, or an item id is not in it | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
released | integer | Yes | Items whose assignment and open claim were removed |
GET /eval/review/queues/{queue_id}/agreement
Show how far reviewers agree with each other
Shows how consistently the reviewers of a queue judge the same items, so you can tell whether the
instructions are clear and whose labels drift: percent agreement and Krippendorff's alpha over items two or
more reviewers labelled, each reviewer's pass rate and agreement with the others, Cohen's kappa for every
pair, and the ids of up to 50 disputed items to settle. Fewer than 30 shared items is flagged as
low_sample. Proxy admins, admin viewers and custom roles with evals.read may call it, each seeing only the
queues its team or organization owns. It changes nothing.
Docs (https://docs.spanway.ai/docs/proxy/enterprise/review_board#reviewer-agreement)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
queue_id | path | string | Yes |
Example request:
curl -X GET "http://localhost:4000/eval/review/queues/queue_id-123/agreement" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Overall, per reviewer and per pair agreement | application/json ReviewerAgreementReport |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The license lacks the evals feature, or the caller's role may not read review queues | application/json ErrorDetail |
| 404 | No queue has this id within the caller's scope | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
queue_id | string | Yes | The queue the labels come from |
overlapping_items | integer | Yes | Items labelled by two or more reviewers |
disputed_items | integer | Yes | Of those, items where reviewers did not all give the same answer |
percent_agreement | number or null | Yes | Mean pairwise agreement over overlapping items, 0 to 1 |
krippendorff_alpha | number or null | Yes | Agreement corrected for chance, 1 is perfect and 0 is chance |
reviewers | array of ReviewerAgreement | Yes | One row per reviewer who labelled anything |
pairs | array of ReviewerPairAgreement | Yes | One row per pair of reviewers who share items |
disputed | array of string | Yes | Review item ids of up to 50 disputed items, most recently labelled first |
GET /eval/feedback
List end-user ratings
Lists the ratings end users gave to gateway requests, newest first, so you can review what people liked and
disliked. Proxy admins and admin viewers see every rating, and a custom role that grants eval reads sees the
ratings of its key's team (or its organization, for an organization admin). Narrow the list to one request with
request_id or one conversation with session_id, and page through
it with page and page_size (at most 200). Nothing is changed.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
request_id | query | string or null | No | |
session_id | query | string or null | No | |
page | query | integer | No | |
page_size | query | integer | No |
Example request:
curl -X GET "http://localhost:4000/eval/feedback" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | One page of ratings, newest first | application/json EvalFeedbackListResponse |
| 400 | The request breaks a rule the detail names | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 409 | The object already exists or is in a state that does not allow this change | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
feedback | array of Spanway_EvalFeedback | Yes | Feedback |
total | integer | Yes | Total |
page | integer | Yes | Page |
page_size | integer | Yes | Page Size |
POST /eval/feedback
Rate a gateway request on behalf of an end user
Records how good an answer was, so you can track quality from your own users' point of view. Your app calls this with the same virtual key that sent the request, or any key of the same team, and sends a score from 0 to 1, a label, or both, plus an optional comment.
Rating the same request again for the same end user replaces the earlier rating. A request id that this key or team did not send answers 404, whether it exists or not, and so does a request whose log row is not written yet (the gateway writes logs in batches a few seconds after the response). When the key, team or organization requires zero data retention, the comment is dropped and only the score, label and ids are kept. A request accepts ratings from at most 20 different end users, the next one answers 409.
Request body (application/json, schema FeedbackSubmission):
| Field | Type | Required | Description |
|---|---|---|---|
request_id | string | Yes | Request Id |
score | number or null | No | Score |
label | string or null | No | Label |
comment | string or null | No | Comment |
end_user | string or null | No | End User |
Example request:
curl -X POST "http://localhost:4000/eval/feedback" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"request_id": "chatcmpl-9f2b7c1d-0000-4a1e-8d3e-123456789abc",
"score": 0.8,
"label": "helpful",
"comment": "Answered the refund question in one go",
"end_user": "customer-1001"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The rating as stored | application/json Spanway_EvalFeedback |
| 400 | The request breaks a rule the detail names | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 409 | The object already exists or is in a state that does not allow this change | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
feedback_id | string | Yes | Feedback Id |
request_id | string | Yes | Request Id |
session_id | string or null | No | Session Id |
score | number or null | No | Score |
label | string or null | No | Label |
comment | string or null | No | Comment |
end_user | string | No | End User |
owner_team_id | string or null | No | Owner Team Id |
owner_org_id | string or null | No | Owner Org Id |
created_at | string or null | No | Created At |
updated_at | string or null | No | Updated At |
DELETE /eval/feedback/{feedback_id}
Delete one end-user rating
Removes one rating for good, for example when an end user asks for their feedback to be erased. Proxy admins, or a custom role that grants eval writes within the rating's scope, may call it. The deleted rating is returned and an audit log entry is written without the comment. An unknown id, or one outside the caller's scope, answers 404.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
feedback_id | path | string | Yes |
Example request:
curl -X DELETE "http://localhost:4000/eval/feedback/feedback_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The rating that was deleted | application/json Spanway_EvalFeedback |
| 400 | The request breaks a rule the detail names | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 409 | The object already exists or is in a state that does not allow this change | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
feedback_id | string | Yes | Feedback Id |
request_id | string | Yes | Request Id |
session_id | string or null | No | Session Id |
score | number or null | No | Score |
label | string or null | No | Label |
comment | string or null | No | Comment |
end_user | string | No | End User |
owner_team_id | string or null | No | Owner Team Id |
owner_org_id | string or null | No | Owner Org Id |
created_at | string or null | No | Created At |
updated_at | string or null | No | Updated At |
GET /eval/runs/{run_id}/items
Read the items a submitted eval run needs answered
Returns the questions of a submitted eval run, at the dataset version the run pinned, so a CI job or a local harness can run its own system on them and post the answers back. Admins and eval readers can call it. A ci key needs read_items in its eval_ci settings, reads only the runs it started, and gets the items without their expected answers, so it cannot grade itself. Nothing changes.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
run_id | path | string | Yes |
Example request:
curl -X GET "http://localhost:4000/eval/runs/run_id-123/items" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The run's items at the dataset version it pinned | application/json EvalRunItems |
| 400 | The request breaks a rule the detail names | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 409 | The object already exists or is in a state that does not allow this change | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
run_id | string | Yes | Run Id |
dataset_id | string | Yes | Dataset Id |
dataset_version | integer or null | Yes | Dataset Version |
items | array of EvalItem | Yes | Items |
POST /eval/runs/{run_id}/outputs
Submit answers to a submitted eval run
Scores up to 100 answers that a system outside the gateway produced for a running submitted run, each for an item of the run's dataset version and a model label, and stores them as the run's results. Admins and eval runners, including ci keys, can call it. An item id the dataset does not have, or an item already submitted for the same model, refuses the whole batch. An item a concurrent batch stored first keeps that result and is counted as already submitted. A batch that ends after the run finished is a 409 and stores nothing. Each batch writes an audit row with its counts, never the answers. A ci key posts only to the runs it started.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
run_id | path | string | Yes |
Request body (application/json, schema SubmitOutputs):
| Field | Type | Required | Description |
|---|---|---|---|
outputs | array of SubmittedOutput | Yes | Outputs |
Example request:
curl -X POST "http://localhost:4000/eval/runs/run_id-123/outputs" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"outputs": [
{
"item_id": "refund-window",
"model": "support-bot-v2",
"output": "You have 14 days to return it."
},
{
"item_id": "shipping-time",
"model": "support-bot-v2",
"transcript": [
{
"role": "user",
"content": "When will my order arrive?"
},
{
"role": "assistant",
"content": "Orders arrive within 3 to 5 business days."
}
]
}
]
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | How many outputs were scored, failed to score or were already stored | application/json SubmittedOutputsResult |
| 400 | The request breaks a rule the detail names | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 409 | The run already finished, failed or was cancelled, so it takes no more outputs | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
run_id | string | Yes | Run Id |
scored | integer | Yes | Scored |
errors | integer | Yes | Errors |
already_submitted | integer | No | Already Submitted |
POST /eval/runs/{run_id}/finish
Finish a submitted eval run
Completes a submitted eval run once every batch of answers is in. Every item without an answer for a model that submitted anything becomes an error row, and the run gets its summary and verdict, so it reads like any other run in the Admin UI and in CI gates. Admins and eval runners can call it, and a ci key only for the runs it started. After this the run takes no more answers. The run before and after is written to the audit log.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
run_id | path | string | Yes |
Request body (application/json, object):
Example request:
curl -X POST "http://localhost:4000/eval/runs/run_id-123/finish" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The finished run with its summary | application/json Spanway_EvalRunTable |
| 400 | The request breaks a rule the detail names | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's role may not do this, or the license lacks the evals feature | application/json ErrorDetail |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 409 | The run already finished, failed or was cancelled, so it takes no more outputs | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
run_id | string | Yes | The id of the eval run |
dataset_id | string | Yes | The dataset the run tests |
dataset_version | integer or null | No | The dataset version the run is pinned to |
name | string or null | No | A label for the run |
models | array of string | Yes | The models the run sends every item to |
scorer | object | Yes | How answers are graded, with the scorer type and its settings |
status | enum: "pending", "running", "completed", "failed", "cancelled" | Yes | pending, running, completed, failed or cancelled |
summary | EvalSummary or null | No | The per model totals, once the run completed |
error | string or null | No | Why the run failed |
schedule_id | string or null | No | The schedule that started the run |
prompt_id | string or null | No | The managed prompt the run rendered |
prompt_version | integer or null | No | The version of the managed prompt the run used |
prompt_environment | string or null | No | The prompt environment the version was taken from |
mode | enum: "single", "replay", "agent", "logged" | No | single, replay, agent or logged, which decides how items are sent |
outputs_source | enum: "dataset", "submitted" | No | dataset when the gateway calls models, submitted when outputs are sent in |
max_steps | integer or null | No | The most agent steps per item in agent mode |
template | StoredPromptTemplate or null | No | The prompt template applied to every item |
params | StoredInferenceParams or null | No | The sampling settings sent with every call |
items_digest | string or null | No | The fingerprint of the items the run tested |
baseline_key | string or null | No | The key CI compares runs under |
git_ref | string or null | No | The git branch or tag CI reported |
git_sha | string or null | No | The git commit CI reported |
ci | CiContext or null | No | Details CI sent about the pipeline that started the run |
gate | EvalGate or null | No | The pass rate thresholds CI checks the run against |
trusted_baseline | boolean | No | Whether later CI runs may be compared with this one |
owner_team_id | string or null | No | The team that owns the run |
owner_org_id | string or null | No | The organization that owns the run |
created_by | string or null | No | Who started the run |
created_at | string or null | No | When the run was created |
started_at | string or null | No | When the first item was sent |
completed_at | string or null | No | When the run finished |
GET /v1/evals
List the evaluations at the model provider
List the evaluations stored at the model provider, newest first by default, a page at a time with limit, after
and before. Nothing is changed.
Only a proxy admin key may call it, or a key whose allowed_routes lists this route. The gateway passes the call to
the model provider, OpenAI unless custom_llm_provider names another, and the account it uses can be picked with a
gateway model name in the x-spanway-model header, the model query parameter or the model body field.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
limit | query | integer or null | No | |
after | query | string or null | No | |
before | query | string or null | No | |
order | query | string or null | No | |
order_by | query | string or null | No | |
custom_llm_provider | query | string or null | No |
Example request:
curl -X GET "http://localhost:4000/v1/evals" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json ListEvalsResponse |
| 400 | The request is invalid, for example a missing or unsupported parameter, a prompt longer than the model's context window, content a guardrail or the provider refused, or no deployment that satisfies the data policy of the key, team or organization (No deployment of model 'gpt-5.5' satisfies the data policy: ...). error.message says which. | application/json ProxyError |
| 401 | No valid key was sent, or the key has expired or is blocked. | application/json ProxyError |
| 403 | The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403. | application/json ProxyError |
| 404 | The route or resource does not exist, or this key cannot see it. An unknown model name is a 400 (Invalid model name passed in model=...). | application/json ProxyError |
| 408 | The provider did not answer before the request timed out. | application/json ProxyError |
| 413 | The request body is larger than max_request_size_mb (100 MB by default), or an upload is larger than its own limit. The gateway refused it before reading the key. Docs | application/json object |
| 422 | The request body does not have the expected shape, or a budget (key, user, team, organization or end user) is used up: error.type is budget_exceeded. The budget status is spanway_settings.budget_exceeded_status_code, 422 by default. With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an error | application/json ProxyError or HTTPValidationError |
| 429 | Too many requests. A provider limit or a gateway limit (requests or tokens per minute, or parallel requests) refused the call, and error.type says which. A gateway limit also sends the RateLimit headers and x-spanway-rate-limited-by. Docs With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an error | application/json ProxyError |
| 500 | The gateway or the provider failed unexpectedly, or the gateway could not reach the provider. Retry, and quote the request id if it keeps failing. | application/json ProxyError |
| 502 | The provider, or a proxy in front of it, answered with something that is not a valid response. | application/json ProxyError |
| 503 | The provider is overloaded or unavailable. With Redis rate limiting, a 503 also means the gateway could not check the rate limit counters and refused the request, because fail_closed_rate_limit_enforcement is on. Docs | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
data | array of Eval | Yes | Data |
first_id | string or null | No | First Id |
has_more | boolean | No | Has More |
last_id | string or null | No | Last Id |
object | string | No | Object |
POST /v1/evals
Create an evaluation at the model provider
Create an evaluation at the model provider: the shape of the rows you will grade (data_source_config) and the
graders that score each row (testing_criteria). Nothing is graded yet, start a run to do that. The provider stores
the evaluation and answers with its id.
Only a proxy admin key may call it, or a key whose allowed_routes lists this route. The gateway passes the call to
the model provider, OpenAI unless custom_llm_provider names another, and the account it uses can be picked with a
gateway model name in the x-spanway-model header, the model query parameter or the model body field.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
custom_llm_provider | query | string or null | No |
Request body (application/json, object):
| Field | Type | Required | Description |
|---|---|---|---|
data_source_config | object | Yes | The shape of the rows to grade, with a type such as custom or logs |
metadata | object or null | No | Up to 16 labels of your own |
model | string or null | No | The gateway model name whose provider account runs the call, used only for routing |
name | string or null | No | A name to recognise the evaluation by |
testing_criteria | array of object | Yes | The graders, each with a type such as string_check or score_model |
Example request:
curl -X POST "http://localhost:4000/v1/evals" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"data_source_config": {
"include_sample_schema": true,
"item_schema": {
"properties": {
"expected_label": {
"type": "string"
},
"ticket": {
"type": "string"
}
},
"required": [
"ticket",
"expected_label"
],
"type": "object"
},
"type": "custom"
},
"metadata": {
"team": "support"
},
"name": "Support ticket labels",
"testing_criteria": [
{
"input": "{{ sample.output_text }}",
"name": "label matches",
"operation": "eq",
"reference": "{{ item.expected_label }}",
"type": "string_check"
}
]
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json Eval |
| 400 | The request is invalid, for example a missing or unsupported parameter, a prompt longer than the model's context window, content a guardrail or the provider refused, or no deployment that satisfies the data policy of the key, team or organization (No deployment of model 'gpt-5.5' satisfies the data policy: ...). error.message says which. | application/json ProxyError |
| 401 | No valid key was sent, or the key has expired or is blocked. | application/json ProxyError |
| 403 | The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403. | application/json ProxyError |
| 404 | The route or resource does not exist, or this key cannot see it. An unknown model name is a 400 (Invalid model name passed in model=...). | application/json ProxyError |
| 408 | The provider did not answer before the request timed out. | application/json ProxyError |
| 413 | The request body is larger than max_request_size_mb (100 MB by default), or an upload is larger than its own limit. The gateway refused it before reading the key. Docs | application/json object |
| 422 | The request body does not have the expected shape, or a budget (key, user, team, organization or end user) is used up: error.type is budget_exceeded. The budget status is spanway_settings.budget_exceeded_status_code, 422 by default. With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an error | application/json ProxyError or HTTPValidationError |
| 429 | Too many requests. A provider limit or a gateway limit (requests or tokens per minute, or parallel requests) refused the call, and error.type says which. A gateway limit also sends the RateLimit headers and x-spanway-rate-limited-by. Docs With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an error | application/json ProxyError |
| 500 | The gateway or the provider failed unexpectedly, or the gateway could not reach the provider. Retry, and quote the request id if it keeps failing. | application/json ProxyError |
| 502 | The provider, or a proxy in front of it, answered with something that is not a valid response. | application/json ProxyError |
| 503 | The provider is overloaded or unavailable. With Redis rate limiting, a 503 also means the gateway could not check the rate limit counters and refused the request, because fail_closed_rate_limit_enforcement is on. Docs | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
created_at | integer | Yes | Created At |
data_source_config | object | Yes | Data Source Config |
id | string | Yes | Id |
metadata | object or null | No | Metadata |
name | string or null | No | Name |
object | string | No | Object |
testing_criteria | array of object | Yes | Testing Criteria |
updated_at | integer or null | No | Updated At |
GET /v1/evals/{eval_id}
Read one evaluation
Read one evaluation by id, with its data source shape and graders. Nothing is changed.
Only a proxy admin key may call it, or a key whose allowed_routes lists this route. The gateway passes the call to
the model provider, OpenAI unless custom_llm_provider names another, and the account it uses can be picked with a
gateway model name in the x-spanway-model header, the model query parameter or the model body field.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
eval_id | path | string | Yes | |
custom_llm_provider | query | string or null | No |
Example request:
curl -X GET "http://localhost:4000/v1/evals/eval_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json Eval |
| 400 | The request is invalid, for example a missing or unsupported parameter, a prompt longer than the model's context window, content a guardrail or the provider refused, or no deployment that satisfies the data policy of the key, team or organization (No deployment of model 'gpt-5.5' satisfies the data policy: ...). error.message says which. | application/json ProxyError |
| 401 | No valid key was sent, or the key has expired or is blocked. | application/json ProxyError |
| 403 | The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403. | application/json ProxyError |
| 404 | The route or resource does not exist, or this key cannot see it. An unknown model name is a 400 (Invalid model name passed in model=...). | application/json ProxyError |
| 408 | The provider did not answer before the request timed out. | application/json ProxyError |
| 413 | The request body is larger than max_request_size_mb (100 MB by default), or an upload is larger than its own limit. The gateway refused it before reading the key. Docs | application/json object |
| 422 | The request body does not have the expected shape, or a budget (key, user, team, organization or end user) is used up: error.type is budget_exceeded. The budget status is spanway_settings.budget_exceeded_status_code, 422 by default. With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an error | application/json ProxyError or HTTPValidationError |
| 429 | Too many requests. A provider limit or a gateway limit (requests or tokens per minute, or parallel requests) refused the call, and error.type says which. A gateway limit also sends the RateLimit headers and x-spanway-rate-limited-by. Docs With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an error | application/json ProxyError |
| 500 | The gateway or the provider failed unexpectedly, or the gateway could not reach the provider. Retry, and quote the request id if it keeps failing. | application/json ProxyError |
| 502 | The provider, or a proxy in front of it, answered with something that is not a valid response. | application/json ProxyError |
| 503 | The provider is overloaded or unavailable. With Redis rate limiting, a 503 also means the gateway could not check the rate limit counters and refused the request, because fail_closed_rate_limit_enforcement is on. Docs | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
created_at | integer | Yes | Created At |
data_source_config | object | Yes | Data Source Config |
id | string | Yes | Id |
metadata | object or null | No | Metadata |
name | string or null | No | Name |
object | string | No | Object |
testing_criteria | array of object | Yes | Testing Criteria |
updated_at | integer or null | No | Updated At |
POST /v1/evals/{eval_id}
Rename an evaluation or change its labels
Change the name or the labels of an evaluation. Its graders and data source cannot change, create a new evaluation for that.
Only a proxy admin key may call it, or a key whose allowed_routes lists this route. The gateway passes the call to
the model provider, OpenAI unless custom_llm_provider names another, and the account it uses can be picked with a
gateway model name in the x-spanway-model header, the model query parameter or the model body field.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
eval_id | path | string | Yes | |
custom_llm_provider | query | string or null | No |
Request body (application/json, object):
| Field | Type | Required | Description |
|---|---|---|---|
metadata | object or null | No | The new labels, replacing the old ones |
model | string or null | No | The gateway model name whose provider account runs the call, used only for routing |
name | string or null | No | The new name |
Example request:
curl -X POST "http://localhost:4000/v1/evals/eval_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"metadata": {
"team": "support"
},
"name": "Support ticket labels v2"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json Eval |
| 400 | The request is invalid, for example a missing or unsupported parameter, a prompt longer than the model's context window, content a guardrail or the provider refused, or no deployment that satisfies the data policy of the key, team or organization (No deployment of model 'gpt-5.5' satisfies the data policy: ...). error.message says which. | application/json ProxyError |
| 401 | No valid key was sent, or the key has expired or is blocked. | application/json ProxyError |
| 403 | The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403. | application/json ProxyError |
| 404 | The route or resource does not exist, or this key cannot see it. An unknown model name is a 400 (Invalid model name passed in model=...). | application/json ProxyError |
| 408 | The provider did not answer before the request timed out. | application/json ProxyError |
| 413 | The request body is larger than max_request_size_mb (100 MB by default), or an upload is larger than its own limit. The gateway refused it before reading the key. Docs | application/json object |
| 422 | The request body does not have the expected shape, or a budget (key, user, team, organization or end user) is used up: error.type is budget_exceeded. The budget status is spanway_settings.budget_exceeded_status_code, 422 by default. With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an error | application/json ProxyError or HTTPValidationError |
| 429 | Too many requests. A provider limit or a gateway limit (requests or tokens per minute, or parallel requests) refused the call, and error.type says which. A gateway limit also sends the RateLimit headers and x-spanway-rate-limited-by. Docs With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an error | application/json ProxyError |
| 500 | The gateway or the provider failed unexpectedly, or the gateway could not reach the provider. Retry, and quote the request id if it keeps failing. | application/json ProxyError |
| 502 | The provider, or a proxy in front of it, answered with something that is not a valid response. | application/json ProxyError |
| 503 | The provider is overloaded or unavailable. With Redis rate limiting, a 503 also means the gateway could not check the rate limit counters and refused the request, because fail_closed_rate_limit_enforcement is on. Docs | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
created_at | integer | Yes | Created At |
data_source_config | object | Yes | Data Source Config |
id | string | Yes | Id |
metadata | object or null | No | Metadata |
name | string or null | No | Name |
object | string | No | Object |
testing_criteria | array of object | Yes | Testing Criteria |
updated_at | integer or null | No | Updated At |
DELETE /v1/evals/{eval_id}
Delete an evaluation
Delete an evaluation at the model provider. This cannot be undone.
Only a proxy admin key may call it, or a key whose allowed_routes lists this route. The gateway passes the call to
the model provider, OpenAI unless custom_llm_provider names another, and the account it uses can be picked with a
gateway model name in the x-spanway-model header, the model query parameter or the model body field.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
eval_id | path | string | Yes | |
custom_llm_provider | query | string or null | No |
Example request:
curl -X DELETE "http://localhost:4000/v1/evals/eval_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json DeleteEvalResponse |
| 400 | The request is invalid, for example a missing or unsupported parameter, a prompt longer than the model's context window, content a guardrail or the provider refused, or no deployment that satisfies the data policy of the key, team or organization (No deployment of model 'gpt-5.5' satisfies the data policy: ...). error.message says which. | application/json ProxyError |
| 401 | No valid key was sent, or the key has expired or is blocked. | application/json ProxyError |
| 403 | The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403. | application/json ProxyError |
| 404 | The route or resource does not exist, or this key cannot see it. An unknown model name is a 400 (Invalid model name passed in model=...). | application/json ProxyError |
| 408 | The provider did not answer before the request timed out. | application/json ProxyError |
| 413 | The request body is larger than max_request_size_mb (100 MB by default), or an upload is larger than its own limit. The gateway refused it before reading the key. Docs | application/json object |
| 422 | The request body does not have the expected shape, or a budget (key, user, team, organization or end user) is used up: error.type is budget_exceeded. The budget status is spanway_settings.budget_exceeded_status_code, 422 by default. With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an error | application/json ProxyError or HTTPValidationError |
| 429 | Too many requests. A provider limit or a gateway limit (requests or tokens per minute, or parallel requests) refused the call, and error.type says which. A gateway limit also sends the RateLimit headers and x-spanway-rate-limited-by. Docs With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an error | application/json ProxyError |
| 500 | The gateway or the provider failed unexpectedly, or the gateway could not reach the provider. Retry, and quote the request id if it keeps failing. | application/json ProxyError |
| 502 | The provider, or a proxy in front of it, answered with something that is not a valid response. | application/json ProxyError |
| 503 | The provider is overloaded or unavailable. With Redis rate limiting, a 503 also means the gateway could not check the rate limit counters and refused the request, because fail_closed_rate_limit_enforcement is on. Docs | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
deleted | boolean | Yes | Deleted |
eval_id | string | Yes | Eval Id |
object | string | No | Object |
POST /v1/evals/{eval_id}/cancel
Cancel an evaluation
Stop an evaluation whose runs are still in progress. Results already graded are kept.
Only a proxy admin key may call it, or a key whose allowed_routes lists this route. The gateway passes the call to
the model provider, OpenAI unless custom_llm_provider names another, and the account it uses can be picked with a
gateway model name in the x-spanway-model header, the model query parameter or the model body field.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
eval_id | path | string | Yes | |
custom_llm_provider | query | string or null | No |
Request body (application/json, object):
| Field | Type | Required | Description |
|---|---|---|---|
model | string | No |
Example request:
curl -X POST "http://localhost:4000/v1/evals/eval_id-123/cancel" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json CancelEvalResponse |
| 400 | The request is invalid, for example a missing or unsupported parameter, a prompt longer than the model's context window, content a guardrail or the provider refused, or no deployment that satisfies the data policy of the key, team or organization (No deployment of model 'gpt-5.5' satisfies the data policy: ...). error.message says which. | application/json ProxyError |
| 401 | No valid key was sent, or the key has expired or is blocked. | application/json ProxyError |
| 403 | The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403. | application/json ProxyError |
| 404 | The route or resource does not exist, or this key cannot see it. An unknown model name is a 400 (Invalid model name passed in model=...). | application/json ProxyError |
| 408 | The provider did not answer before the request timed out. | application/json ProxyError |
| 413 | The request body is larger than max_request_size_mb (100 MB by default), or an upload is larger than its own limit. The gateway refused it before reading the key. Docs | application/json object |
| 422 | The request body does not have the expected shape, or a budget (key, user, team, organization or end user) is used up: error.type is budget_exceeded. The budget status is spanway_settings.budget_exceeded_status_code, 422 by default. With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an error | application/json ProxyError or HTTPValidationError |
| 429 | Too many requests. A provider limit or a gateway limit (requests or tokens per minute, or parallel requests) refused the call, and error.type says which. A gateway limit also sends the RateLimit headers and x-spanway-rate-limited-by. Docs With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an error | application/json ProxyError |
| 500 | The gateway or the provider failed unexpectedly, or the gateway could not reach the provider. Retry, and quote the request id if it keeps failing. | application/json ProxyError |
| 502 | The provider, or a proxy in front of it, answered with something that is not a valid response. | application/json ProxyError |
| 503 | The provider is overloaded or unavailable. With Redis rate limiting, a 503 also means the gateway could not check the rate limit counters and refused the request, because fail_closed_rate_limit_enforcement is on. Docs | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Id |
object | string | No | Object |
status | "cancelled" | Yes | Status |
GET /v1/evals/{eval_id}/runs
List the runs of an evaluation
List the runs of one evaluation with their status and pass and fail counts, a page at a time. Nothing is changed.
Only a proxy admin key may call it, or a key whose allowed_routes lists this route. The gateway passes the call to
the model provider, OpenAI unless custom_llm_provider names another, and the account it uses can be picked with a
gateway model name in the x-spanway-model header, the model query parameter or the model body field.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
eval_id | path | string | Yes | |
limit | query | integer or null | No | |
after | query | string or null | No | |
before | query | string or null | No | |
order | query | string or null | No | |
custom_llm_provider | query | string or null | No |
Example request:
curl -X GET "http://localhost:4000/v1/evals/eval_id-123/runs" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json ListRunsResponse |
| 400 | The request is invalid, for example a missing or unsupported parameter, a prompt longer than the model's context window, content a guardrail or the provider refused, or no deployment that satisfies the data policy of the key, team or organization (No deployment of model 'gpt-5.5' satisfies the data policy: ...). error.message says which. | application/json ProxyError |
| 401 | No valid key was sent, or the key has expired or is blocked. | application/json ProxyError |
| 403 | The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403. | application/json ProxyError |
| 404 | The route or resource does not exist, or this key cannot see it. An unknown model name is a 400 (Invalid model name passed in model=...). | application/json ProxyError |
| 408 | The provider did not answer before the request timed out. | application/json ProxyError |
| 413 | The request body is larger than max_request_size_mb (100 MB by default), or an upload is larger than its own limit. The gateway refused it before reading the key. Docs | application/json object |
| 422 | The request body does not have the expected shape, or a budget (key, user, team, organization or end user) is used up: error.type is budget_exceeded. The budget status is spanway_settings.budget_exceeded_status_code, 422 by default. With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an error | application/json ProxyError or HTTPValidationError |
| 429 | Too many requests. A provider limit or a gateway limit (requests or tokens per minute, or parallel requests) refused the call, and error.type says which. A gateway limit also sends the RateLimit headers and x-spanway-rate-limited-by. Docs With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an error | application/json ProxyError |
| 500 | The gateway or the provider failed unexpectedly, or the gateway could not reach the provider. Retry, and quote the request id if it keeps failing. | application/json ProxyError |
| 502 | The provider, or a proxy in front of it, answered with something that is not a valid response. | application/json ProxyError |
| 503 | The provider is overloaded or unavailable. With Redis rate limiting, a 503 also means the gateway could not check the rate limit counters and refused the request, because fail_closed_rate_limit_enforcement is on. Docs | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
data | array of Run | Yes | Data |
first_id | string or null | No | First Id |
has_more | boolean | No | Has More |
last_id | string or null | No | Last Id |
object | string | No | Object |
POST /v1/evals/{eval_id}/runs
Start a run of an evaluation
Start grading: run an evaluation over a data source, either a file of rows that already hold the answers or a model and the prompts to send it. The run starts queued, so read it again to follow its progress and results. The provider bills the model calls a run makes.
Only a proxy admin key may call it, or a key whose allowed_routes lists this route. The gateway passes the call to
the model provider, OpenAI unless custom_llm_provider names another, and the account it uses can be picked with a
gateway model name in the x-spanway-model header, the model query parameter or the model body field.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
eval_id | path | string | Yes | |
custom_llm_provider | query | string or null | No |
Request body (application/json, object):
| Field | Type | Required | Description |
|---|---|---|---|
data_source | object | Yes | What to grade: a file of rows, or a model and the prompts to send it |
metadata | object or null | No | Up to 16 labels of your own |
model | string or null | No | The gateway model name whose provider account runs the call, used only for routing |
name | string or null | No | A name to recognise the run by |
Example request:
curl -X POST "http://localhost:4000/v1/evals/eval_id-123/runs" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"data_source": {
"input_messages": {
"template": [
{
"content": "Label this ticket: {{ item.ticket }}",
"role": "user"
}
],
"type": "template"
},
"model": "gpt-5-mini",
"source": {
"id": "file-4b5a4c6d9e7f0a1b",
"type": "file_id"
},
"type": "completions"
},
"name": "gpt-5-mini baseline"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json Run |
| 400 | The request is invalid, for example a missing or unsupported parameter, a prompt longer than the model's context window, content a guardrail or the provider refused, or no deployment that satisfies the data policy of the key, team or organization (No deployment of model 'gpt-5.5' satisfies the data policy: ...). error.message says which. | application/json ProxyError |
| 401 | No valid key was sent, or the key has expired or is blocked. | application/json ProxyError |
| 403 | The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403. | application/json ProxyError |
| 404 | The route or resource does not exist, or this key cannot see it. An unknown model name is a 400 (Invalid model name passed in model=...). | application/json ProxyError |
| 408 | The provider did not answer before the request timed out. | application/json ProxyError |
| 413 | The request body is larger than max_request_size_mb (100 MB by default), or an upload is larger than its own limit. The gateway refused it before reading the key. Docs | application/json object |
| 422 | The request body does not have the expected shape, or a budget (key, user, team, organization or end user) is used up: error.type is budget_exceeded. The budget status is spanway_settings.budget_exceeded_status_code, 422 by default. With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an error | application/json ProxyError or HTTPValidationError |
| 429 | Too many requests. A provider limit or a gateway limit (requests or tokens per minute, or parallel requests) refused the call, and error.type says which. A gateway limit also sends the RateLimit headers and x-spanway-rate-limited-by. Docs With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an error | application/json ProxyError |
| 500 | The gateway or the provider failed unexpectedly, or the gateway could not reach the provider. Retry, and quote the request id if it keeps failing. | application/json ProxyError |
| 502 | The provider, or a proxy in front of it, answered with something that is not a valid response. | application/json ProxyError |
| 503 | The provider is overloaded or unavailable. With Redis rate limiting, a 503 also means the gateway could not check the rate limit counters and refused the request, because fail_closed_rate_limit_enforcement is on. Docs | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
completed_at | integer or null | No | Completed At |
created_at | integer | Yes | Created At |
data_source | object | Yes | Data Source |
error | object or null | No | Error |
eval_id | string | Yes | Eval Id |
id | string | Yes | Id |
metadata | object or null | No | Metadata |
model | string or null | No | Model |
name | string or null | No | Name |
object | string | No | Object |
per_model_usage | any or null | No | Per Model Usage |
per_testing_criteria_results | array of PerTestingCriteriaResult or null | No | Per Testing Criteria Results |
report_url | string or null | No | Report Url |
result_counts | object or null | No | Result Counts |
shared_with_openai | boolean or null | No | Shared With Openai |
started_at | integer or null | No | Started At |
status | enum: "queued", "running", "completed", "failed", "cancelled" | Yes | Status |
GET /v1/evals/{eval_id}/runs/{run_id}
Read one run and its results
Read one run: its status, how many rows passed, failed or errored for each grader, and the provider's report link. Nothing is changed.
Only a proxy admin key may call it, or a key whose allowed_routes lists this route. The gateway passes the call to
the model provider, OpenAI unless custom_llm_provider names another, and the account it uses can be picked with a
gateway model name in the x-spanway-model header, the model query parameter or the model body field.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
eval_id | path | string | Yes | |
run_id | path | string | Yes | |
custom_llm_provider | query | string or null | No |
Example request:
curl -X GET "http://localhost:4000/v1/evals/eval_id-123/runs/run_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json Run |
| 400 | The request is invalid, for example a missing or unsupported parameter, a prompt longer than the model's context window, content a guardrail or the provider refused, or no deployment that satisfies the data policy of the key, team or organization (No deployment of model 'gpt-5.5' satisfies the data policy: ...). error.message says which. | application/json ProxyError |
| 401 | No valid key was sent, or the key has expired or is blocked. | application/json ProxyError |
| 403 | The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403. | application/json ProxyError |
| 404 | The route or resource does not exist, or this key cannot see it. An unknown model name is a 400 (Invalid model name passed in model=...). | application/json ProxyError |
| 408 | The provider did not answer before the request timed out. | application/json ProxyError |
| 413 | The request body is larger than max_request_size_mb (100 MB by default), or an upload is larger than its own limit. The gateway refused it before reading the key. Docs | application/json object |
| 422 | The request body does not have the expected shape, or a budget (key, user, team, organization or end user) is used up: error.type is budget_exceeded. The budget status is spanway_settings.budget_exceeded_status_code, 422 by default. With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an error | application/json ProxyError or HTTPValidationError |
| 429 | Too many requests. A provider limit or a gateway limit (requests or tokens per minute, or parallel requests) refused the call, and error.type says which. A gateway limit also sends the RateLimit headers and x-spanway-rate-limited-by. Docs With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an error | application/json ProxyError |
| 500 | The gateway or the provider failed unexpectedly, or the gateway could not reach the provider. Retry, and quote the request id if it keeps failing. | application/json ProxyError |
| 502 | The provider, or a proxy in front of it, answered with something that is not a valid response. | application/json ProxyError |
| 503 | The provider is overloaded or unavailable. With Redis rate limiting, a 503 also means the gateway could not check the rate limit counters and refused the request, because fail_closed_rate_limit_enforcement is on. Docs | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
completed_at | integer or null | No | Completed At |
created_at | integer | Yes | Created At |
data_source | object | Yes | Data Source |
error | object or null | No | Error |
eval_id | string | Yes | Eval Id |
id | string | Yes | Id |
metadata | object or null | No | Metadata |
model | string or null | No | Model |
name | string or null | No | Name |
object | string | No | Object |
per_model_usage | any or null | No | Per Model Usage |
per_testing_criteria_results | array of PerTestingCriteriaResult or null | No | Per Testing Criteria Results |
report_url | string or null | No | Report Url |
result_counts | object or null | No | Result Counts |
shared_with_openai | boolean or null | No | Shared With Openai |
started_at | integer or null | No | Started At |
status | enum: "queued", "running", "completed", "failed", "cancelled" | Yes | Status |
POST /v1/evals/{eval_id}/runs/{run_id}
Cancel a run
Stop a queued or running run. Rows already graded keep their results.
Only a proxy admin key may call it, or a key whose allowed_routes lists this route. The gateway passes the call to
the model provider, OpenAI unless custom_llm_provider names another, and the account it uses can be picked with a
gateway model name in the x-spanway-model header, the model query parameter or the model body field.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
eval_id | path | string | Yes | |
run_id | path | string | Yes | |
custom_llm_provider | query | string or null | No |
Request body (application/json, object):
| Field | Type | Required | Description |
|---|---|---|---|
model | string | No |
Example request:
curl -X POST "http://localhost:4000/v1/evals/eval_id-123/runs/run_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json CancelRunResponse |
| 400 | The request is invalid, for example a missing or unsupported parameter, a prompt longer than the model's context window, content a guardrail or the provider refused, or no deployment that satisfies the data policy of the key, team or organization (No deployment of model 'gpt-5.5' satisfies the data policy: ...). error.message says which. | application/json ProxyError |
| 401 | No valid key was sent, or the key has expired or is blocked. | application/json ProxyError |
| 403 | The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403. | application/json ProxyError |
| 404 | The route or resource does not exist, or this key cannot see it. An unknown model name is a 400 (Invalid model name passed in model=...). | application/json ProxyError |
| 408 | The provider did not answer before the request timed out. | application/json ProxyError |
| 413 | The request body is larger than max_request_size_mb (100 MB by default), or an upload is larger than its own limit. The gateway refused it before reading the key. Docs | application/json object |
| 422 | The request body does not have the expected shape, or a budget (key, user, team, organization or end user) is used up: error.type is budget_exceeded. The budget status is spanway_settings.budget_exceeded_status_code, 422 by default. With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an error | application/json ProxyError or HTTPValidationError |
| 429 | Too many requests. A provider limit or a gateway limit (requests or tokens per minute, or parallel requests) refused the call, and error.type says which. A gateway limit also sends the RateLimit headers and x-spanway-rate-limited-by. Docs With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an error | application/json ProxyError |
| 500 | The gateway or the provider failed unexpectedly, or the gateway could not reach the provider. Retry, and quote the request id if it keeps failing. | application/json ProxyError |
| 502 | The provider, or a proxy in front of it, answered with something that is not a valid response. | application/json ProxyError |
| 503 | The provider is overloaded or unavailable. With Redis rate limiting, a 503 also means the gateway could not check the rate limit counters and refused the request, because fail_closed_rate_limit_enforcement is on. Docs | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Id |
object | string | No | Object |
status | "cancelled" | Yes | Status |
DELETE /v1/evals/{eval_id}/runs/{run_id}
Delete a run
Delete one run and its results at the model provider. The evaluation itself is kept. This cannot be undone.
Only a proxy admin key may call it, or a key whose allowed_routes lists this route. The gateway passes the call to
the model provider, OpenAI unless custom_llm_provider names another, and the account it uses can be picked with a
gateway model name in the x-spanway-model header, the model query parameter or the model body field.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
eval_id | path | string | Yes | |
run_id | path | string | Yes | |
custom_llm_provider | query | string or null | No |
Example request:
curl -X DELETE "http://localhost:4000/v1/evals/eval_id-123/runs/run_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json RunDeleteResponse |
| 400 | The request is invalid, for example a missing or unsupported parameter, a prompt longer than the model's context window, content a guardrail or the provider refused, or no deployment that satisfies the data policy of the key, team or organization (No deployment of model 'gpt-5.5' satisfies the data policy: ...). error.message says which. | application/json ProxyError |
| 401 | No valid key was sent, or the key has expired or is blocked. | application/json ProxyError |
| 403 | The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403. | application/json ProxyError |
| 404 | The route or resource does not exist, or this key cannot see it. An unknown model name is a 400 (Invalid model name passed in model=...). | application/json ProxyError |
| 408 | The provider did not answer before the request timed out. | application/json ProxyError |
| 413 | The request body is larger than max_request_size_mb (100 MB by default), or an upload is larger than its own limit. The gateway refused it before reading the key. Docs | application/json object |
| 422 | The request body does not have the expected shape, or a budget (key, user, team, organization or end user) is used up: error.type is budget_exceeded. The budget status is spanway_settings.budget_exceeded_status_code, 422 by default. With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an error | application/json ProxyError or HTTPValidationError |
| 429 | Too many requests. A provider limit or a gateway limit (requests or tokens per minute, or parallel requests) refused the call, and error.type says which. A gateway limit also sends the RateLimit headers and x-spanway-rate-limited-by. Docs With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an error | application/json ProxyError |
| 500 | The gateway or the provider failed unexpectedly, or the gateway could not reach the provider. Retry, and quote the request id if it keeps failing. | application/json ProxyError |
| 502 | The provider, or a proxy in front of it, answered with something that is not a valid response. | application/json ProxyError |
| 503 | The provider is overloaded or unavailable. With Redis rate limiting, a 503 also means the gateway could not check the rate limit counters and refused the request, because fail_closed_rate_limit_enforcement is on. Docs | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
deleted | boolean or null | No | Deleted |
object | string or null | No | Object |
run_id | string | Yes | Run Id |