---
title: "Save an evaluation case for an agent"
method: POST
path: "/voice/agents/{agent_id}/test-cases"
tags: ["Voice"]
---

# Save an evaluation case for an agent

`POST /voice/agents/{agent_id}/test-cases`

## Request

- Base URL: `https://be.graph8.com/api/v1`
- URL: `https://be.graph8.com/api/v1/voice/agents/{agent_id}/test-cases`
- Auth: HTTP bearer

SPENDS NOTHING. Saves a named case: the user turn, its context, and the
assertion the agent's resolved behaviour must satisfy.

`created_by` defaults to the key's identity, since a server-to-server
call carries no request-context user for voice to fall back on.

## Path parameters

- `agent_id` string, required: Voice agent id.

## Headers

- `Authorization` string, nullable
- `X-Target-Org-Id` string, nullable

## Request body

- AgentTestCaseCreate: A saved evaluation case: the user turn under test and what must hold. `llm_judge` may be SAVED but is skipped by dry runs - a judge needs a real completion, and a dry run never calls a model.
  - `name` string, required
  - `input_message` string, required: The user turn under test.
  - `input_context` object, nullable: Surrounding facts held constant (prior turns, contact, company).
  - `channel` 'chat' | 'inbound' | 'outbound': Selects the per-channel instructions.
  - `expected_output` unknown
  - `assertion_type` 'exact' | 'contains' | 'not_contains' | 'expects_tool' | 'refuses' | 'cites_collection' | 'llm_judge'
  - `assertion_config` object, nullable: Assertion options: target (resolved_instructions | tool_names | grounding_sources), case_sensitive, tool, collection_id, capability_tools, refusal_markers.
  - `created_by` string, nullable: Attribution; defaults to the key's identity.

## Response `201`

Successful Response

- ApiResponseVoicePayload
  - `data` VoicePayload, required: One voice object - a collection, an agent, a route, a chat. Open-shaped: voice adds fields to these bodies on its own release cadence and a dropped-or-added key must not be a 500 in this service.
  - `pagination` PaginationMeta
    - `page` integer, required: Current page number (1-indexed)
    - `limit` integer, required: Items per page
    - `total` integer, required: Total number of items
    - `has_next` boolean, required: Whether there are more pages
    - `next_cursor` string, nullable: Opaque cursor for the next page; null when there are no more items. Pass it back as the `cursor` query param to fetch the following page without computing page numbers.
    - `total_available` integer, nullable: Search endpoints only: how many records really match, when known. Can be larger than `total`, which is capped at the 10,000 results that can be paged. For company search this is a distinct-company estimate. Null when unknown; absent outside search.
    - `total_is_lower_bound` boolean, nullable: Search endpoints only: true when more records match than `total` shows (the result set is larger than the 10,000 results that can be paged). Absent outside search.
    - `notes` string[], nullable: Search endpoints only: plain-language notes about the result, e.g. that more records match than can be paged, or that a reversed `between` range was put in order.

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/graph8/apis/graph8-developer-api.md) · [All operations](https://skmtc.dev/graph8/apis/graph8-developer-api/llms.txt) · [OpenAPI document](https://skmtc.dev/graph8/apis/graph8-developer-api/revisions/2e7cfa0ca921?raw)
