{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/prodantix-com/json-schema/prodantix-com-agent-conversation-schema.json",
  "title": "AgentConversation",
  "x-generated": "2026-11-22",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/prodantix-com-openapi.json#/components/schemas/AgentConversation",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "distinctId": {
      "type": "string"
    },
    "subject": {
      "type": [
        "string",
        "null"
      ]
    },
    "status": {
      "type": "string"
    },
    "assigneeUserId": {
      "type": [
        "string",
        "null"
      ]
    },
    "assigneeMemberSub": {
      "type": [
        "string",
        "null"
      ],
      "description": "The assignee's identity sub, the id members are named by everywhere\nelse in the console and API."
    },
    "snoozedUntil": {
      "type": [
        "string",
        "null"
      ]
    },
    "unreadForAgent": {
      "type": "boolean"
    },
    "lastTurnAt": {
      "type": "string"
    },
    "createdAt": {
      "type": "string"
    },
    "flagged": {
      "type": "boolean",
      "description": "An agent's mark on the thread, for the Flagged view. Never reaches the\nend-user wire."
    },
    "personName": {
      "type": [
        "string",
        "null"
      ],
      "description": "The person's `$name` trait, so a row can name an identified customer\nthe way the thread header does. Null while they are anonymous."
    },
    "personEmail": {
      "type": [
        "string",
        "null"
      ],
      "description": "The person's `$email` trait, under the same rule."
    },
    "lastTurnBody": {
      "type": [
        "string",
        "null"
      ],
      "description": "The first 200 characters of the latest turn, for the row's preview.\nNull on a thread with no turn yet."
    },
    "lastTurnAuthorKind": {
      "type": [
        "string",
        "null"
      ],
      "description": "Who wrote that latest turn (`end_user`, `agent` or `ai`), so the preview\ncan say whose words they are."
    },
    "heldAsSpamAt": {
      "type": [
        "string",
        "null"
      ]
    },
    "openHandover": {
      "anyOf": [
        {
          "$ref": "#/$defs/Handover"
        },
        {
          "type": "null"
        }
      ]
    },
    "priority": {
      "$ref": "#/$defs/Priority"
    },
    "attributes": {
      "type": "object",
      "additionalProperties": true
    },
    "visitorLanguage": {
      "type": [
        "string",
        "null"
      ],
      "description": "The language the visitor writes in, by code, once the triage or a\ntranslation of their words has found it. Null until then."
    },
    "channel": {
      "type": "string",
      "description": "Where the conversation came in: `messenger`, `email`, `sms`, `whatsapp`, `slack` or `phone`."
    }
  },
  "required": [
    "id",
    "distinctId",
    "status",
    "unreadForAgent",
    "lastTurnAt",
    "createdAt",
    "flagged",
    "priority",
    "attributes",
    "channel"
  ],
  "$defs": {
    "Handover": {
      "type": "object",
      "properties": {
        "reason": {
          "type": "string"
        },
        "openedAt": {
          "type": "string"
        },
        "clearedAt": {
          "type": [
            "string",
            "null"
          ]
        },
        "turnId": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "reason",
        "openedAt"
      ]
    },
    "Priority": {
      "type": "string",
      "enum": [
        "low",
        "normal",
        "high",
        "urgent"
      ]
    }
  }
}