VocalDocscontracts 1.65.0

Add a labeled case to a decision corpus

POST /v1/agents/{agent_id}/decision-corpora/{corpus_id}/cases

PropertyValue
Operationcreate_decision_case
GroupDecision corpora
Scopeagents:write
Route classcontrol
IdempotencyIdempotency-Key accepted: a retry with the same key replays the first answer
AuditAudited decision_case.create (mutation)
Released in1.58.0
Phase 0 hostServed (the hosted api pins 1.65.0)

Adds a case and raises the corpus's version (1.58.0): a synthetic case with its state, or a production case naming a Call and Turn whose redacted caller text the api copies, an audited content read and write that needs the Organization's opt-in (decision_case_production_not_allowed), from 1.59.0 its production_decision_cases. From 1.59.0 copying a Turn's caller text reads the class transcripts of the Call: an API key needs transcripts:read beside agents:write, and a Member a cell or grant get_call_content_access answers allowed for it, or the create is 403 forbidden as a read of the case would be. The Audit event records the case, never its state.

Request

Set VOCAL_API to the base URL of your API and VOCAL_API_KEY to an API key with the agents:write scope (Authentication and keys). Replace each placeholder, such as agt_... or <name>, with your own value.

curl -X POST "$VOCAL_API/v1/agents/agt_.../decision-corpora/dcp_.../cases" \
  -H "Authorization: Bearer $VOCAL_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "source": "synthetic",
    "expected": {}
  }'

Parameters

NameInTypeRequiredDescription
agent_idpathAgentIdyesThe id of an Agent: agt_ and the row's UUIDv7 in 26 Crockford base32 characters. Opaque and safe to log.
corpus_idpathDecisionCorpusIdyesThe id of a decision corpus: dcp_ and the row's UUIDv7 in 26 Crockford base32 characters. Opaque and safe to log.
idempotency-keyheaderstringnoA client-chosen key, kept 24 hours per Organization, environment and route. A replay returns the stored response.

Request body

Content type application/json, required: DecisionCaseCreateRequest.

FieldTypeRequiredDescription
call_idCallIdnoA production case only.
expectedmap of DecisionExpectedAnsweryesThe answer expected of each question by id; a question left out is not scored.
sourceone of "synthetic", "production"yessynthetic with its state, or production with its call_id and turn_seq.
stateDecisionStateDocumentnoA synthetic case only.
turn_seqintegernoA production case only.

Responses

StatusContent typeShapeError codes
201application/jsonDecisionCase
400application/jsonErrorEnvelopeinvalid_request
401application/jsonErrorEnvelopeunauthenticated
403application/jsonErrorEnvelopeforbidden, org_suspended
404application/jsonErrorEnvelopenot_found
409application/jsonErrorEnvelopedecision_corpus_archived, idempotency_in_progress, idempotency_key_reused
422application/jsonErrorEnvelopevalidation_failed
429application/jsonErrorEnveloperate_limited
500application/jsonErrorEnvelopeinternal_error

Fields of the 201 answer

The shape is DecisionCase.

FieldTypeRequiredDescription
call_idCallId or nullyesThe Call of a production case; null otherwise.
corpus_idDecisionCorpusIdyes
created_atTimestampyes
expectedmap of DecisionExpectedAnsweryesThe answer expected of each question by id; a question left out is not scored.
idDecisionCaseIdyes
labelled_byActorRefyes
object"decision_case"yes
sourceDecisionCaseSourceyes
stateDecisionStateDocumentyesThe state the questions are asked of; content, read under an audited content read. From 1.59.0 the state of a production case is of the content class transcripts of its Call (the reads of the case say what that asks of the reader); the state of another case is not Call content.
turn_seqinteger or nullyesThe Turn of a production case; null otherwise.