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

# Add tickets to a dataset

> Requires packs:write. Tickets are redacted before they are stored. A dataset holds at most 250 tickets. JSON body is { tickets }. text/csv needs a header row with subject and customerMessage. externalId is optional.



## OpenAPI

````yaml /openapi.json post /api/datasets/{datasetId}/tickets
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/datasets/{datasetId}/tickets:
    post:
      tags:
        - Datasets
      summary: Add tickets to a dataset
      description: >-
        Requires packs:write. Tickets are redacted before they are stored. A
        dataset holds at most 250 tickets. JSON body is { tickets }. text/csv
        needs a header row with subject and customerMessage. externalId is
        optional.
      operationId: addDatasetTickets
      parameters:
        - $ref: '#/components/parameters/datasetId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TicketsBody'
          text/csv:
            schema:
              type: string
      responses:
        '201':
          description: How many tickets were stored.
          content:
            application/json:
              schema:
                type: object
                required:
                  - inserted
                  - total
                properties:
                  inserted:
                    type: integer
                  total:
                    type: integer
        default:
          $ref: '#/components/responses/Error'
components:
  parameters:
    datasetId:
      name: datasetId
      in: path
      required: true
      schema:
        type: string
  schemas:
    TicketsBody:
      type: object
      required:
        - tickets
      properties:
        tickets:
          type: array
          minItems: 1
          items:
            $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.