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

# Judge a ticket

> API key only. Requires judgments:run. Judges the published version. An optional Idempotency-Key returns the stored evaluation when the same key is sent again. A gateway failure does not store the key.



## OpenAPI

````yaml /openapi.json post /api/judge
openapi: 3.1.0
info:
  title: judged.systems
  version: 0.1.0
  description: >-
    Judge one support ticket. Product routes accept an API key or a browser
    session. If a key is sent, the session is not used. POST /api/judge and POST
    /api/webhooks/inbound accept an API key only. Send the key in the x-api-key
    header or as Authorization: Bearer.
servers:
  - url: https://judged.systems
security:
  - apiKey: []
  - bearerAuth: []
  - {}
tags:
  - name: Packs
  - name: Judge
  - name: Evaluations
  - name: Reviews
  - name: Labels
  - name: Datasets
  - name: Simulations
  - name: Stats
  - name: Webhooks
paths:
  /api/judge:
    post:
      tags:
        - Judge
      summary: Judge a ticket
      description: >-
        API key only. Requires judgments:run. Judges the published version. An
        optional Idempotency-Key returns the stored evaluation when the same key
        is sent again. A gateway failure does not store the key.
      operationId: judgeTicket
      parameters:
        - $ref: '#/components/parameters/idempotencyKeyOptional'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/JudgeBody'
      responses:
        '200':
          description: The stored judgment.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JudgeResponse'
        default:
          $ref: '#/components/responses/Error'
      security:
        - apiKey: []
        - bearerAuth: []
components:
  parameters:
    idempotencyKeyOptional:
      name: Idempotency-Key
      in: header
      required: false
      schema:
        type: string
        minLength: 1
        maxLength: 128
  schemas:
    JudgeBody:
      type: object
      required:
        - packId
        - ticket
      example:
        packId: PACK_ID
        ticket:
          externalId: '48213'
          subject: Charged twice for May
          customerMessage: I was billed twice and want one refunded.
      properties:
        packId:
          type: string
          minLength: 1
        ticket:
          $ref: '#/components/schemas/Ticket'
    JudgeResponse:
      type: object
      required:
        - evaluationId
        - result
        - packVersionId
      properties:
        evaluationId:
          type: string
        result:
          $ref: '#/components/schemas/JudgmentResult'
        packVersionId:
          type: string
    Ticket:
      type: object
      required:
        - subject
        - customerMessage
      example:
        externalId: '48213'
        subject: Charged twice for May
        customerMessage: I was billed twice and want one refunded.
      properties:
        externalId:
          type: string
          minLength: 1
        subject:
          type: string
          minLength: 1
        customerMessage:
          type: string
          minLength: 1
        messages:
          type: array
          items:
            $ref: '#/components/schemas/TicketMessage'
        metadata:
          type: object
          additionalProperties:
            type:
              - string
              - number
              - boolean
              - 'null'
        createdAt:
          type: string
          format: date-time
    JudgmentResult:
      type: object
      required:
        - status
        - answers
        - reviewReasons
        - modelId
        - latencyMs
      properties:
        status:
          $ref: '#/components/schemas/ResultStatus'
        answers:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/Answer'
        reviewReasons:
          type: array
          items:
            type: string
        derived:
          type: object
          properties:
            department:
              type: string
            priority:
              type: string
            tags:
              type: array
              items:
                type: string
        usage:
          type: object
          properties:
            inputTokens:
              type: number
            outputTokens:
              type: number
        modelId:
          type: string
          minLength: 1
        latencyMs:
          type: number
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: string
        issues:
          type: array
          items:
            type: object
    TicketMessage:
      type: object
      required:
        - role
        - text
      properties:
        role:
          type: string
          enum:
            - customer
            - agent
            - system
        text:
          type: string
        at:
          type: string
          format: date-time
    ResultStatus:
      type: string
      enum:
        - accept
        - review
        - reject
    Answer:
      oneOf:
        - $ref: '#/components/schemas/ChoiceAnswer'
        - $ref: '#/components/schemas/ScoreAnswer'
        - $ref: '#/components/schemas/BooleanAnswer'
    ChoiceAnswer:
      type: object
      required:
        - type
        - choice
      properties:
        type:
          const: choice
        choice:
          type: string
        probabilities:
          type: object
          additionalProperties:
            type: number
            minimum: 0
            maximum: 1
    ScoreAnswer:
      type: object
      required:
        - type
        - score
      properties:
        type:
          const: score
        score:
          type: number
        probabilities:
          type: object
          additionalProperties:
            type: number
            minimum: 0
            maximum: 1
    BooleanAnswer:
      type: object
      required:
        - type
        - probability
      properties:
        type:
          const: boolean
        probability:
          type: number
          minimum: 0
          maximum: 1
  responses:
    Error:
      description: >-
        Error body is { error: string }. Status is 400, 401, 403, 404, 409, 429,
        or 500. A 400 from a schema failure also includes issues.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key
    bearerAuth:
      type: http
      scheme: bearer
      description: 'The API key, sent as Authorization: Bearer.'

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.