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

# Accept an inbound ticket

> API key only. Requires judgments:run. Idempotency-Key is the delivery id and is required. Returns 202 and keeps judging. The pack must have a published version. A repeated delivery id returns the existing event.



## OpenAPI

````yaml /openapi.json post /api/webhooks/inbound
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/webhooks/inbound:
    post:
      tags:
        - Webhooks
      summary: Accept an inbound ticket
      description: >-
        API key only. Requires judgments:run. Idempotency-Key is the delivery id
        and is required. Returns 202 and keeps judging. The pack must have a
        published version. A repeated delivery id returns the existing event.
      operationId: acceptInboundWebhook
      parameters:
        - $ref: '#/components/parameters/idempotencyKeyRequired'
        - $ref: '#/components/parameters/inboundSignature'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/JudgeBody'
      responses:
        '202':
          description: The event was accepted.
          content:
            application/json:
              schema:
                type: object
                required:
                  - eventId
                properties:
                  eventId:
                    type: string
        default:
          $ref: '#/components/responses/Error'
      security:
        - apiKey: []
        - bearerAuth: []
components:
  parameters:
    idempotencyKeyRequired:
      name: Idempotency-Key
      in: header
      required: true
      schema:
        type: string
        minLength: 1
        maxLength: 128
    inboundSignature:
      name: X-Judged-Signature
      in: header
      required: false
      schema:
        type: string
      description: Optional. sha256= plus the HMAC-SHA256 of the raw body.
  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'
    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
    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
  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.