{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/microsoft-azure-communication-services/json-schema/microsoft-azure-communication-services-create-chat-thread-request-schema.json",
  "title": "CreateChatThreadRequest",
  "description": "Request payload for creating a chat thread.",
  "x-generated": "2026-11-05",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/microsoft-azure-communication-services-chat-api-openapi.yml#/components/schemas/CreateChatThreadRequest",
  "required": [
    "topic"
  ],
  "type": "object",
  "properties": {
    "topic": {
      "description": "The chat thread topic.",
      "type": "string"
    },
    "participants": {
      "description": "Participants to be added to the chat thread.",
      "type": "array",
      "items": {
        "$ref": "#/$defs/ChatParticipant"
      }
    },
    "metadata": {
      "description": "Contextual metadata for the thread. The metadata consists of name/value pairs. The total size of all metadata pairs can be up to 1KB in size.",
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    },
    "retentionPolicy": {
      "$ref": "#/$defs/ChatRetentionPolicy"
    }
  },
  "$defs": {
    "ChatParticipant": {
      "description": "A participant of the chat thread.",
      "required": [
        "communicationIdentifier"
      ],
      "type": "object",
      "properties": {
        "communicationIdentifier": {
          "$ref": "#/$defs/CommunicationIdentifierModel"
        },
        "displayName": {
          "description": "Display name for the chat participant.",
          "type": "string"
        },
        "shareHistoryTime": {
          "format": "date-time",
          "description": "Time from which the chat history is shared with the participant. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`.",
          "type": "string"
        },
        "metadata": {
          "description": "Contextual metadata for the chat participant. The metadata consists of name/value pairs. The total size of all metadata pairs can be up to 1KB in size.",
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        }
      }
    },
    "ChatRetentionPolicy": {
      "description": "Data retention policy for auto deletion.",
      "type": "object",
      "properties": {
        "kind": {
          "description": "Retention Policy Type",
          "enum": [
            "threadCreationDate",
            "none"
          ],
          "type": "string",
          "x-ms-enum": {
            "name": "RetentionPolicyKind",
            "modelAsString": true,
            "values": [
              {
                "value": "threadCreationDate",
                "description": "Thread retention policy based on thread creation date."
              },
              {
                "value": "none",
                "description": "No thread retention policy"
              }
            ]
          }
        }
      },
      "required": [
        "kind"
      ]
    },
    "CommunicationIdentifierModel": {
      "$ref": "../../../Common/stable/2025-06-30/common.json#/components/schemas/CommunicationIdentifierModel"
    }
  }
}