> ## Documentation Index
> Fetch the complete documentation index at: https://docs.visiqlabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Evaluate a governed event (unified)

> The single, operation-native evaluation endpoint. Declare which operations the event performs via `operations[]` and receive the union decision vocabulary. Hybrid events (e.g. `["retrieval","action"]`) are evaluated on both facets and combined fail-closed to the most restrictive outcome. A legacy `{ kind: "action" | "retrieval", ... }` shape is also accepted for compatibility.

Requires scope `rules:evaluate` (dual-accepts the legacy `allow:write` / `recall:write`).




## OpenAPI

````yaml /api-reference/openapi.yaml post /evaluate
openapi: 3.1.0
info:
  title: VisIQ Governance API
  version: 1.0.0
  description: >
    The VisIQ platform API for governing agentic AI. One rule engine evaluates
    every governed agent event against your policies and returns a decision
    (permit, deny, approval-required, redact, mask, or escalate), records a
    cryptographically-verifiable audit trail, and governs agent-to-agent
    delegation.


    All requests are authenticated with a bearer API key. Mint a key in the
    dashboard under **Connectors -> API Keys**; it is presented as
    `Authorization: Bearer vq_prod_...`. Keys are scoped: harness/agent keys
    reach the operational surface (evaluate, rule bundles, telemetry, record
    ingestion), while management keys and dashboard sessions govern rules,
    agents, settings, and audit reads through role-based permissions.


    Decision vocabularies differ per facet. Action governance emits `permit |
    deny | approval_required | mask`. Retrieval governance emits `allow | deny |
    redact | escalate`. The unified `POST /evaluate` surface projects both into
    a single union vocabulary (`permit | deny | approval_required | redact |
    escalate | mask`).
  contact:
    name: VisIQ Labs
    url: https://docs.visiqlabs.com
servers:
  - url: https://api.visiqlabs.com
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Evaluation
    description: Per-event governance decisions for action, retrieval, and delegation.
  - name: Action Rules
    description: Manage the rules that govern agent actions (writes/tool calls).
  - name: Retrieval Rules
    description: Manage the rules that govern retrieval and context exposure.
  - name: Unified Rules
    description: Operation-native rule management across both facets in one surface.
  - name: Rule Bundles
    description: Compiled, cacheable rule bundles the SDK runtime pulls per agent.
  - name: Agents
    description: Register and manage the agents whose events you govern.
  - name: Human-in-the-loop
    description: The approval queue for events that require a human decision.
  - name: Settings
    description: Per-account governance defaults.
  - name: Delegation
    description: Govern scoped agent-to-agent hand-offs with signed grant tokens.
  - name: Records
    description: Ingest, retrieve, finalize, and verify the tamper-evident audit trail.
  - name: Audit Log
    description: Versioned, paginated read APIs over recorded decisions and events.
  - name: Cognition
    description: >-
      Read captured Agent Cortex cognition sessions and beats (dedicated
      cognition:read scope).
paths:
  /evaluate:
    post:
      tags:
        - Evaluation
      summary: Evaluate a governed event (unified)
      description: >
        The single, operation-native evaluation endpoint. Declare which
        operations the event performs via `operations[]` and receive the union
        decision vocabulary. Hybrid events (e.g. `["retrieval","action"]`) are
        evaluated on both facets and combined fail-closed to the most
        restrictive outcome. A legacy `{ kind: "action" | "retrieval", ... }`
        shape is also accepted for compatibility.


        Requires scope `rules:evaluate` (dual-accepts the legacy `allow:write` /
        `recall:write`).
      operationId: evaluateUnified
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UnifiedEvaluateRequest'
            example:
              operations:
                - action
              agent_id: billing-copilot
              target_app: stripe
              action: refund.create
              context:
                amount_cents: 5000
      responses:
        '200':
          description: The unified decision. `results[]` is present for hybrid events.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnifiedDecision'
              example:
                operations:
                  - action
                decision: permit
                plane_decision: permit
                reason: Within policy
                reason_code: null
                rule_code: R-1042
                enforced: true
                agent_mode: enforce
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
      security:
        - bearerAuth: []
components:
  schemas:
    UnifiedEvaluateRequest:
      type: object
      required:
        - operations
        - agent_id
      description: >
        The operation-native request. Include action fields (`target_app`,
        `action`) when `operations` contains `action` or `delegation`; include
        retrieval fields (`resource_type`, ...) when it contains `retrieval`. A
        legacy `{ kind: "action" | "retrieval", ... }` body is also accepted.
      properties:
        operations:
          type: array
          minItems: 1
          maxItems: 3
          items:
            type: string
            enum:
              - action
              - retrieval
              - delegation
        agent_id:
          type: string
          minLength: 1
          maxLength: 255
        target_app:
          type: string
          minLength: 1
          maxLength: 255
        action:
          type: string
          minLength: 1
          maxLength: 255
        context:
          type: object
          additionalProperties: true
          default: {}
        operation:
          type: string
          enum:
            - retrieve
            - tool_call
            - prompt_render
        resource_type:
          type: string
          minLength: 1
          maxLength: 255
        resource_metadata:
          type: object
          additionalProperties: true
          default: {}
        trust_tier:
          type:
            - string
            - 'null'
          maxLength: 64
        surface:
          type:
            - string
            - 'null'
          maxLength: 128
        query:
          type:
            - string
            - 'null'
          maxLength: 4000
        telemetry:
          type: object
          additionalProperties: true
    UnifiedDecision:
      type: object
      required:
        - operations
        - decision
      description: >
        For single-facet events the top-level fields carry the projected
        decision. For hybrid events, `decision` is the most-restrictive outcome
        and `results[]` carries the per-operation breakdown.
      properties:
        operations:
          type: array
          items:
            type: string
            enum:
              - action
              - retrieval
              - delegation
        decision:
          type: string
          enum:
            - permit
            - deny
            - approval_required
            - redact
            - escalate
            - mask
        plane_decision:
          type: string
          description: >-
            The originating facet's verbatim decision word (single-facet
            responses).
        reason:
          type:
            - string
            - 'null'
        reason_code:
          type:
            - string
            - 'null'
        rule_code:
          type:
            - string
            - 'null'
        enforced:
          type:
            - boolean
            - 'null'
        agent_mode:
          type:
            - string
            - 'null'
          enum:
            - 'off'
            - monitor
            - enforce
            - null
        decision_id:
          type:
            - string
            - 'null'
        redaction_rules:
          type: array
          items:
            type: object
            additionalProperties: true
        hitl_fallback:
          type: string
        results:
          type: array
          description: Present for hybrid events — one entry per evaluated operation.
          items:
            type: object
            properties:
              operation:
                type: string
                enum:
                  - action
                  - retrieval
                  - delegation
              decision:
                type: string
                enum:
                  - permit
                  - deny
                  - approval_required
                  - redact
                  - escalate
                  - mask
              plane_decision:
                type: string
              reason:
                type:
                  - string
                  - 'null'
              reason_code:
                type:
                  - string
                  - 'null'
              rule_code:
                type:
                  - string
                  - 'null'
    Error:
      type: object
      required:
        - error
      description: >
        The standard error envelope. `details` carries the validation issue list
        on 400s; authorization failures add fields such as `detail`,
        `requiredScopes`, or `requiredPermission`.
      properties:
        error:
          type: string
        detail:
          type: string
        code:
          type: string
        details:
          type: array
          items:
            type: object
            additionalProperties: true
      additionalProperties: true
  responses:
    BadRequest:
      description: The request was malformed or failed validation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: Invalid request body
            details:
              - path:
                  - agent_id
                message: Required
    Unauthorized:
      description: Missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: Unauthorized
    Forbidden:
      description: The key lacks the required permission or scope.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: insufficient_scope
            detail: This API key is not authorized for the requested operation.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >
        A VisIQ API key presented as `Authorization: Bearer vq_prod_...`. Mint
        keys under **Connectors -> API Keys** in the dashboard.

````