VocalDocscontracts 1.65.0

Dry-run a Policy against a synthetic context

POST /v1/policies/{policy_id}/evaluate

PropertyValue
Operationevaluate_policy
GroupPolicies
Scopepolicies:write
Route classcontrol
IdempotencyIdempotency-Key accepted: a retry with the same key replays the first answer
AuditNot audited: A dry run: it changes no state and reads no Call content, so it writes no Audit event (ADR 0012, orchestration-layer.md 3.12).
Released in1.47.0
Phase 0 hostServed (the hosted api pins 1.65.0)

Evaluates the draft, or a published version, at its hook against the synthetic context of the body, and answers the outcome, its resolution under the compliance tag, the action, the _rule row and, on request, the engine trace (FR-orchestration-8). Fields the body omits arrive as null; a root the hook does not carry is refused with validation_failed and policy_field_unavailable_at_hook. It writes nothing: no Call event, Audit event or Usage event.

Request

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

curl -X POST "$VOCAL_API/v1/policies/pol_.../evaluate" \
  -H "Authorization: Bearer $VOCAL_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "context": {}
  }'

Parameters

NameInTypeRequiredDescription
policy_idpathPolicyIdyesThe id of a Policy: pol_ 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: PolicyEvaluateRequest.

FieldTypeRequiredDescription
contextPolicyContextInputyes
tracebooleannoReturn the engine's trace; false when omitted.
versioninteger or "draft"noA published version, or draft, the default.

Responses

StatusContent typeShapeError codes
200application/jsonPolicyEvaluateResult
400application/jsonErrorEnvelopeinvalid_request
401application/jsonErrorEnvelopeunauthenticated
403application/jsonErrorEnvelopeforbidden
404application/jsonErrorEnvelopenot_found
409application/jsonErrorEnvelopeidempotency_in_progress, idempotency_key_reused
422application/jsonErrorEnvelopevalidation_failed
429application/jsonErrorEnveloperate_limited
500application/jsonErrorEnvelopeinternal_error

Fields of the 200 answer

The shape is PolicyEvaluateResult.

FieldTypeRequiredDescription
actionPolicyAction or nullyesThe matched action with its parameters; null when not matched, and when it applies by failing closed.
action_typePolicyActionTypeyes
appliesbooleanyesWhether the action applies after orchestration-layer.md 3.9: when matched, or when a compliance-tagged Policy fails closed.
causePolicyOutcomeCause or nullyesWhy the outcome is error or timeout; null otherwise.
compliance_tagComplianceTag or nullyes
elapsed_usnumberyesThe evaluation time in microseconds, as the engine measured it (a measurement of this run, never a budget).
engine_versionstringyes
fail_closedbooleanyesTrue when the action applies only because the compliance tag resolved an error or a timeout.
hookHookPointyes
object"policy_evaluation"yes
outcomePolicyOutcomeyes
outputanyyesThe engine's output as it returned it; null on an error.
policy_idPolicyIdyes
rule_idstring or nullyesThe _id of the table row that matched (the _rule output), or null.
tracearray or nullyesThe engine trace when the request asked for it; null otherwise. Returned, never stored.
versioninteger or "draft"yesThe version that ran, or draft.