{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/revdoku-com/json-schema/revdoku-com-ticket-schema.json",
  "title": "Ticket",
  "x-generated": "2026-11-23",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/revdoku-com-openapi.json#/components/schemas/Ticket",
  "type": "object",
  "required": [
    "id",
    "number",
    "status",
    "subject",
    "channel",
    "requester",
    "labels",
    "message_count",
    "unread_count",
    "internal_note",
    "sources",
    "created_at",
    "updated_at",
    "last_message_at",
    "solved_at"
  ],
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^tkt_",
      "description": "Ticket ID for API calls."
    },
    "number": {
      "type": "integer",
      "minimum": 1,
      "description": "Ticket number in the bucket. Replies end their subject with [#number]."
    },
    "status": {
      "type": "string",
      "enum": [
        "open",
        "pending",
        "solved"
      ],
      "description": "open: the ticket waits for the bucket's team. pending: a reply was sent and the ticket waits for the requester. solved: done. A new message from the requester makes a pending or solved ticket open again."
    },
    "subject": {
      "type": [
        "string",
        "null"
      ],
      "description": "Subject of the first message. Null while that message is withheld."
    },
    "channel": {
      "type": "string",
      "enum": [
        "email",
        "chat",
        "feedback"
      ],
      "description": "Where the ticket started: an email, a message left on the docs site or an earlier page feedback email."
    },
    "requester": {
      "oneOf": [
        {
          "$ref": "#/$defs/DecodedEmailAddress"
        },
        {
          "type": "null"
        }
      ],
      "description": "The person who wrote. Null for an earlier page feedback email, which nobody can reply to."
    },
    "labels": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/EmailLabel"
      },
      "description": "Labels of the ticket's messages."
    },
    "message_count": {
      "type": "integer",
      "minimum": 0
    },
    "unread_count": {
      "type": "integer",
      "minimum": 0,
      "description": "Received messages that nobody has read."
    },
    "internal_note": {
      "type": [
        "string",
        "null"
      ],
      "description": "The team's internal note on this ticket. It is never sent to the requester: do not quote it in a reply."
    },
    "sources": {
      "type": "array",
      "description": "What the built-in support agent used for its drafts on this ticket, the newest last.",
      "items": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string",
            "description": "A page address of the site, a file path of a private note, or note: and the title of an article that is not published."
          },
          "kind": {
            "type": "string",
            "enum": [
              "page",
              "unpublished",
              "private"
            ]
          }
        },
        "required": [
          "path",
          "kind"
        ]
      }
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time",
      "description": "Last activity: the newest message or a status change."
    },
    "last_message_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "solved_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    }
  },
  "$defs": {
    "DecodedEmailAddress": {
      "type": "object",
      "required": [
        "address",
        "name"
      ],
      "properties": {
        "address": {
          "type": "string"
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "EmailLabel": {
      "type": "object",
      "required": [
        "id",
        "name",
        "color"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^tag_"
        },
        "name": {
          "type": "string"
        },
        "color": {
          "type": "string",
          "enum": [
            "red",
            "orange",
            "yellow",
            "green",
            "blue",
            "purple",
            "gray"
          ]
        }
      }
    }
  }
}