> ## 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.

# Align a criterion against your labels

> Judge every labeled trace with this criterion and measure agreement: TPR and TNR with 95% Wilson intervals, plus Cohen's κ — never raw agreement (class imbalance inflates it). Needs at least 30 labels (aim for 100). Billed as judging; the confusion matrix is stored row by row so every disagreement stays auditable.

This number is what turns "the judge said 80%" into "the judge says 80%, agrees with YOU 91% of the time, so the corrected rate is 85% [79–90%]".



## OpenAPI

````yaml /openapi.json post /v1/criteria/{id}/align
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/criteria/{id}/align:
    post:
      tags:
        - Criteria
      summary: Align a criterion against your labels
      description: >-
        Judge every labeled trace with this criterion and measure agreement: TPR
        and TNR with 95% Wilson intervals, plus Cohen's κ — never raw agreement
        (class imbalance inflates it). Needs at least 30 labels (aim for 100).
        Billed as judging; the confusion matrix is stored row by row so every
        disagreement stays auditable.


        This number is what turns "the judge said 80%" into "the judge says 80%,
        agrees with YOU 91% of the time, so the corrected rate is 85% [79–90%]".
      operationId: alignCriterion
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: >-
            Label sets of 50 or fewer are judged synchronously and return the
            AlignmentReport. Larger sets return AlignmentQueued ({queued: true,
            total_labels}) and a background worker builds the report over the
            following minutes; poll GET /v1/criteria/{id} for the metrics and
            GET /v1/criteria/{id}/alignment for the full report.
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/AlignmentReport'
                  - $ref: '#/components/schemas/AlignmentQueued'
        '400':
          description: >-
            Fewer than 30 gradeable labels in this criterion's population (the
            error names the population and your current count), or another
            invalid state.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          $ref: '#/components/responses/InsufficientBalance'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  schemas:
    AlignmentReport:
      type: object
      properties:
        scope_tag:
          type: string
          description: >-
            The population measured — the criterion's tag ('' = all labeled
            traffic). Alignment numbers only describe the population they were
            measured on.
        scope_family:
          type: string
          description: >-
            The auto-detected traffic segment measured ("" = no segment scope).
            The second population handle, same binding rule as scope_tag.
        tag_breakdown:
          type: array
          description: >-
            What the measured labels were made of, by tag ('' = untagged). One
            entry for a scoped criterion; the pollution report for an unscoped
            one.
          items:
            type: object
            properties:
              tag:
                type: string
              'n':
                type: integer
        mixed_population:
          type: boolean
          description: >-
            True when an UNSCOPED criterion was measured across more than one
            tag — the metrics describe a blend of tasks, not any one of them.
            Scope the criterion and re-align.
        excluded_other_cause:
          type: integer
          description: >-
            Fails attributed to other criteria: in scope but excluded from this
            criterion's calibration set by cause attribution.
        unattributed_fails:
          type: integer
          description: >-
            In-population fails with no cause attribution. They still count as
            fails for every criterion; attributing them tightens narrow judges'
            numbers.
        metrics:
          type: object
          description: >-
            n, tpr, tnr, kappa and the 95% Wilson intervals (tprCi, tnrCi;
            camelCase on this payload). tpr/tnr are null when the label set has
            no human fails/passes to measure against.
        tier:
          type: string
          enum:
            - aligned
            - weak
            - misaligned
            - unmeasured
        thin_alignment_set:
          type: boolean
          description: 'True under 100 judgeable labels: intervals stay wide; label more.'
        skipped:
          type: integer
          description: >-
            Labeled traces whose content aged out, or whose judge verdict was
            unparseable twice.
        holdout:
          type:
            - object
            - 'null'
          description: >-
            Present at 80+ judged labels: {tune_n, report_n}. Metrics above come
            from the report half only; tune-half rows exist for prompt
            iteration.
        one_class_note:
          type:
            - string
            - 'null'
          description: >-
            Set when null TPR/TNR is a one-class measured set (a labeling gap),
            naming the missing class, so it is never mistaken for "never
            aligned" or a broken judge.
        disagreements:
          type: array
          items:
            type: object
            properties:
              request_id:
                type: string
              judge_verdict:
                type: string
              human_verdict:
                type: string
      description: >-
        Returned by POST /v1/criteria/{id}/align for label sets of 50 or fewer
        (larger sets return AlignmentQueued and the report is built over the
        following minutes).
    AlignmentQueued:
      type: object
      description: >-
        Returned instead of a report when the label set is large: the run
        advances in background slices; read the finished report via GET
        /v1/criteria/{id}/alignment.
      properties:
        queued:
          type: boolean
        total_labels:
          type: integer
    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:
    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
    InsufficientBalance:
      description: Your wallet can't cover the required prepaid runway.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              message: >-
                Insufficient balance: deploying this endpoint requires at least
                1h of runway. Top up and try again.
              type: insufficient_quota
              code: insufficient_balance
    Forbidden:
      description: The key lacks the required owner/admin permission.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: The resource does not exist in your workspace.
      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>`.

````