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

# Label a trace

> Record a human pass/fail verdict on one logged request (owner/admin key — labels DEFINE quality). Downstream systems that already know an output was good or bad can push verdicts here too: a support tool marking an escalation, a pipeline that caught a wrong extraction.

Labels are the foundation of validated evals: judge alignment (TPR/TNR/κ), corrected pass rates, and the quality-gated canary all hang off them. Aim for ~100; stop when 20 in a row teach you nothing new.



## OpenAPI

````yaml /openapi.json post /v1/labels
openapi: 3.1.0
info:
  title: Omnia Management API
  description: >-
    The management API behind the improvement loop: capture and setup, request
    logs and datasets, grades (labels), judges (criteria), evals and deploy
    gates, fine-tuning and reinforcement learning, dedicated GPU endpoints, and
    model aliases and versions. Authenticated with a workspace API key
    (sk_sovereign_...). The inference API (chat, embeddings, rerank, responses)
    is OpenAI-compatible and documented separately.


    Responses are snake_case, list endpoints on the loop products use the
    {"object": "list", "data": [...]} envelope, and refusals use the same nested
    error shape the gateway emits: {"error": {"message", "type", "code"}}.
    Request bodies on the loop products (logs, labels, criteria, evals,
    datasets, aliases) are snake_case; the training and infrastructure products
    (fine-tuning, GRPO, environment tools, dedicated, model-version adoption)
    validate camelCase bodies, and each schema below says which it is. Endpoints
    that spend money require a key minted by a workspace owner or admin and
    return 403 otherwise.
  version: 1.0.0
servers:
  - url: https://gateway.omnia-voice.com
    description: Production
  - url: https://platform.omnia-voice.com/api
    description: Production (legacy alias — same API, older base URL)
security:
  - bearerAuth: []
paths:
  /v1/labels:
    post:
      tags:
        - Labels
      summary: Label a trace
      description: >-
        Record a human pass/fail verdict on one logged request (owner/admin key
        — labels DEFINE quality). Downstream systems that already know an output
        was good or bad can push verdicts here too: a support tool marking an
        escalation, a pipeline that caught a wrong extraction.


        Labels are the foundation of validated evals: judge alignment
        (TPR/TNR/κ), corrected pass rates, and the quality-gated canary all hang
        off them. Aim for ~100; stop when 20 in a row teach you nothing new.
      operationId: createLabel
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateTraceLabel'
      responses:
        '201':
          description: The stored label.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TraceLabel'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
components:
  schemas:
    CreateTraceLabel:
      type: object
      required:
        - request_id
        - verdict
      properties:
        request_id:
          type: string
        verdict:
          type: string
          enum:
            - pass
            - fail
          description: >-
            Binary, always. Upsert by request_id: re-labeling replaces the
            verdict — the newest judgment is the truth.
        critique:
          type:
            - string
            - 'null'
          maxLength: 2000
          description: >-
            WHY, in your words (max 2000 chars). Strongly encouraged on fails:
            critiques become judge few-shot material, feed suggested judges, and
            make disagreement review meaningful.
      description: >-
        Labels created over the API are request-scoped (one exchange). Whole-run
        (trace) grading is done in the dashboard's review queue.
    TraceLabel:
      type: object
      properties:
        id:
          type: string
        request_id:
          type: string
          description: The gateway request this verdict is about.
        verdict:
          type: string
          enum:
            - pass
            - fail
        critique:
          type:
            - string
            - 'null'
          description: >-
            WHY it failed — becomes judge few-shot material and the raw text
            'Suggest criteria' clusters into your failure taxonomy.
        source:
          type: string
          enum:
            - human
            - assist_accepted
        scope:
          type: string
          description: >-
            request grades one exchange; trace grades a whole agent run (the
            label rides the run's final step). Labels created over this API are
            request-scoped.
          enum:
            - request
            - trace
        fail_causes:
          type: array
          description: >-
            Cause attribution: criterion ids this failure indicts. Managed from
            the dashboard's review queue; empty on unattributed fails.
          items:
            type: string
        created_at:
          type: string
          format: date-time
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            type:
              type: string
              description: >-
                invalid_request_error, insufficient_quota, rate_limit_error, or
                api_error.
            code:
              type: string
              description: >-
                Machine-stable cause, e.g. invalid_api_key, not_found,
                insufficient_permissions, precondition_failed.
          required:
            - message
            - type
            - code
      description: >-
        Every refusal — gateway and management API alike — uses this one
        envelope.
  responses:
    BadRequest:
      description: Malformed request or invalid field.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Missing, malformed, or revoked API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              message: Invalid API key
              type: invalid_request_error
              code: invalid_api_key
    Forbidden:
      description: The key lacks the required owner/admin permission.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Your workspace API key, e.g. `sk_sovereign_...`, sent as `Authorization:
        Bearer <key>`.

````