{
  "openapi": "3.1.0",
  "info": {
    "title": "OpenCX API",
    "description": "\nOpenCX is an AI-powered, all-in-one platform for customer support and outbound communications.\n\nUse this API to manage your OpenCX organization's AI agents, actions, conversations, contacts, and more.\n\nTo get started, generate a new API key from the dashboard.\n\n## Authentication\nAll API endpoints require authentication using a Bearer token. You can generate an API key from your OpenCX dashboard.\n\n## Rate Limiting\nAPI requests are rate limited to ensure fair usage. The current limits are:\n- 100 requests per minute for standard endpoints\n- 1000 requests per minute for streaming endpoints\n\n## Error Handling\nThe API uses standard HTTP status codes and returns detailed error messages in the response body.\n",
    "version": "1.0-beta",
    "license": {
      "name": "MIT",
      "url": "https://opensource.org/licenses/MIT"
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    },
    "schemas": {
      "SessionChannel": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SessionChannel",
        "type": "string",
        "enum": [
          "web",
          "email",
          "phone_voice",
          "slack",
          "sms",
          "whatsapp",
          "instagram",
          "messenger",
          "api",
          "web_voice",
          "twitter",
          "twitter_mentions",
          "app_review",
          "internal"
        ]
      },
      "MergeSessionsInput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/MergeSessionsInputInput",
        "type": "object",
        "properties": {
          "idempotencyKey": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "sources": {
            "minItems": 1,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "sessionId": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "closed_resolved",
                    "closed_unresolved"
                  ]
                }
              },
              "required": [
                "sessionId",
                "status"
              ]
            }
          }
        },
        "required": [
          "sources"
        ]
      },
      "ContactsFilter": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ContactsFilter",
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "all_contacts"
              }
            },
            "required": [
              "type"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "contact_id_in"
              },
              "contact_ids": {
                "type": "array",
                "items": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                }
              }
            },
            "required": [
              "type",
              "contact_ids"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "contacts_created_at_between"
              },
              "after": {
                "type": "string",
                "format": "date-time"
              },
              "before": {
                "type": "string",
                "format": "date-time"
              }
            },
            "required": [
              "type"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "contacts_email_domain_name_in"
              },
              "domain_name_in": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "type",
              "domain_name_in"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "contacts_affected_by_sequence"
              },
              "sequence_id": {
                "type": "string"
              }
            },
            "required": [
              "type",
              "sequence_id"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "contacts_name_in"
              },
              "name_in": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "type",
              "name_in"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "contacts_phone_number_in"
              },
              "phone_number_in": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Full phone numbers, matched exactly on digits (formatting like +, spaces, and dashes is ignored). Use * inside an entry for partial/substring matching."
              }
            },
            "required": [
              "type",
              "phone_number_in"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "contacts_email_in"
              },
              "email_in": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "type",
              "email_in"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "contacts_attributes_in"
              },
              "attributes": {
                "type": "array",
                "items": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {
                    "type": "string"
                  }
                }
              }
            },
            "required": [
              "type"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "contacts_sessions_attributes_in"
              },
              "attributes": {
                "type": "array",
                "items": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {
                    "type": "string"
                  }
                }
              }
            },
            "required": [
              "type"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "contact_belongs_to_segment"
              },
              "segment_id": {
                "type": "string"
              },
              "belongs": {
                "type": "boolean"
              }
            },
            "required": [
              "type",
              "segment_id"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "last_contacted_at_between"
              },
              "after": {
                "type": "string",
                "format": "date-time"
              },
              "before": {
                "type": "string",
                "format": "date-time"
              }
            },
            "required": [
              "type"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "last_contacted_at_with_handoff_between"
              },
              "after": {
                "type": "string",
                "format": "date-time"
              },
              "before": {
                "type": "string",
                "format": "date-time"
              }
            },
            "required": [
              "type"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "contact_has_phone"
              },
              "has": {
                "type": "boolean"
              }
            },
            "required": [
              "type",
              "has"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "contact_has_email"
              },
              "has": {
                "type": "boolean"
              }
            },
            "required": [
              "type",
              "has"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "contact_is_blocked"
              },
              "blocked": {
                "type": "boolean"
              }
            },
            "required": [
              "type",
              "blocked"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "contact_is_unsubscribed"
              },
              "unsubscribed": {
                "type": "boolean"
              }
            },
            "required": [
              "type",
              "unsubscribed"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "contacts_custom_data"
              },
              "conditions": {
                "minItems": 1,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "key": {
                      "type": "string",
                      "minLength": 1
                    },
                    "op": {
                      "type": "string",
                      "enum": [
                        "exists",
                        "not_exists",
                        "eq",
                        "neq",
                        "contains"
                      ]
                    },
                    "value": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "key",
                    "op"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "type",
              "conditions"
            ],
            "additionalProperties": false
          }
        ]
      },
      "MessageOptionType": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/MessageOptionType",
        "type": "string",
        "enum": [
          "text",
          "workflow"
        ]
      },
      "SalesforceReplyTemplateRules": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SalesforceReplyTemplateRules",
        "type": "object",
        "properties": {
          "conditions": {
            "minItems": 1,
            "maxItems": 10,
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "attribute"
                    },
                    "key": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "op": {
                      "type": "string",
                      "enum": [
                        "exists",
                        "not_exists",
                        "eq",
                        "neq",
                        "contains"
                      ]
                    },
                    "value": {
                      "type": "string",
                      "maxLength": 500
                    }
                  },
                  "required": [
                    "type",
                    "key",
                    "op"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "tag"
                    },
                    "op": {
                      "type": "string",
                      "enum": [
                        "has",
                        "not_has"
                      ]
                    },
                    "value": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    }
                  },
                  "required": [
                    "type",
                    "op",
                    "value"
                  ],
                  "additionalProperties": false
                }
              ]
            }
          }
        },
        "required": [
          "conditions"
        ],
        "additionalProperties": false
      },
      "CreateSalesforceAiReplyTemplateDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CreateSalesforceAiReplyTemplateDtoInput",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "template_html": {
            "type": "string",
            "minLength": 1,
            "maxLength": 20000
          },
          "is_default": {
            "type": "boolean"
          },
          "rules": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SalesforceReplyTemplateRules"
              },
              {
                "type": "null"
              }
            ]
          },
          "from_address": {
            "description": "From address of the AI agent's autopilot Case email: a literal address, a {{session attribute}} such as {{sf_case_LatestPOSEmail__c}}, or an {{#if …}} branch, resolved per session. Used only when it resolves to an email address; otherwise Salesforce's default sender applies. Empty or null clears it.",
            "anyOf": [
              {
                "type": "string",
                "maxLength": 500
              },
              {
                "type": "null"
              }
            ]
          },
          "to_address": {
            "description": "To address of the AI agent's autopilot Case email: a literal address, a {{session attribute}} such as {{reservation_email}}, or an {{#if …}} branch, resolved per session. Used only when it resolves to an email address; otherwise the Case contact's address applies. Empty or null clears it.",
            "anyOf": [
              {
                "type": "string",
                "maxLength": 500
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "name",
          "template_html"
        ]
      },
      "UpdateSalesforceAiReplyTemplateDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdateSalesforceAiReplyTemplateDtoInput",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "template_html": {
            "type": "string",
            "minLength": 1,
            "maxLength": 20000
          },
          "is_default": {
            "type": "boolean"
          },
          "rules": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SalesforceReplyTemplateRules"
              },
              {
                "type": "null"
              }
            ]
          },
          "from_address": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 500
              },
              {
                "type": "null"
              }
            ],
            "description": "From address of the AI agent's autopilot Case email: a literal address, a {{session attribute}} such as {{sf_case_LatestPOSEmail__c}}, or an {{#if …}} branch, resolved per session. Used only when it resolves to an email address; otherwise Salesforce's default sender applies. Empty or null clears it."
          },
          "to_address": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 500
              },
              {
                "type": "null"
              }
            ],
            "description": "To address of the AI agent's autopilot Case email: a literal address, a {{session attribute}} such as {{reservation_email}}, or an {{#if …}} branch, resolved per session. Used only when it resolves to an email address; otherwise the Case contact's address applies. Empty or null clears it."
          }
        }
      },
      "PreviewSalesforceAiReplyTemplateDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/PreviewSalesforceAiReplyTemplateDtoInput",
        "type": "object",
        "properties": {
          "template_html": {
            "type": "string",
            "minLength": 1,
            "maxLength": 20000
          },
          "session_number": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          },
          "from_address": {
            "description": "From address of the AI agent's autopilot Case email: a literal address, a {{session attribute}} such as {{sf_case_LatestPOSEmail__c}}, or an {{#if …}} branch, resolved per session. Used only when it resolves to an email address; otherwise Salesforce's default sender applies. Empty or null clears it.",
            "anyOf": [
              {
                "type": "string",
                "maxLength": 500
              },
              {
                "type": "null"
              }
            ]
          },
          "to_address": {
            "description": "To address of the AI agent's autopilot Case email: a literal address, a {{session attribute}} such as {{reservation_email}}, or an {{#if …}} branch, resolved per session. Used only when it resolves to an email address; otherwise the Case contact's address applies. Empty or null clears it.",
            "anyOf": [
              {
                "type": "string",
                "maxLength": 500
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "template_html"
        ]
      },
      "OfficeHoursExceptionDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/OfficeHoursExceptionDto",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "starts_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:Z|))$",
            "description": "Inclusive local start, YYYY-MM-DDTHH:mm:ss, in the schedule timezone"
          },
          "ends_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:Z|))$",
            "description": "Exclusive local end, YYYY-MM-DDTHH:mm:ss, in the schedule timezone"
          },
          "kind": {
            "type": "string",
            "enum": [
              "holiday",
              "closed",
              "open"
            ],
            "description": "Holiday and closed periods override opening hours. Holiday takes precedence."
          },
          "repeat_yearly": {
            "default": false,
            "description": "Repeat on the same month and day each year, starting in the specified year",
            "type": "boolean"
          }
        },
        "required": [
          "name",
          "starts_at",
          "ends_at",
          "kind",
          "repeat_yearly"
        ],
        "additionalProperties": false
      },
      "CreateSlaPolicyDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CreateSlaPolicyDtoInput",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "office_hours_id": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              {
                "type": "null"
              }
            ]
          },
          "first_reply_target_seconds": {
            "anyOf": [
              {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "next_reply_target_seconds": {
            "anyOf": [
              {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "resolution_target_seconds": {
            "anyOf": [
              {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "answer_target_seconds": {
            "description": "Phone: callers waiting for a human must be answered within this many seconds (office hours only, when the policy has them).",
            "anyOf": [
              {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "answer_target_percent": {
            "description": "Phone: goal for the share of calls answered within the target.",
            "anyOf": [
              {
                "type": "integer",
                "minimum": 1,
                "maximum": 100
              },
              {
                "type": "null"
              }
            ]
          },
          "answer_count_mode": {
            "description": "Phone: all_offered counts callers who were never answered as missed; answered_only grades answered calls only.",
            "type": "string",
            "enum": [
              "all_offered",
              "answered_only"
            ]
          },
          "answer_short_abandon_seconds": {
            "description": "Phone: leave out callers who hang up within this many seconds of waiting.",
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "name"
        ]
      },
      "UpdateSlaPolicyDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdateSlaPolicyDtoInput",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "office_hours_id": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              {
                "type": "null"
              }
            ]
          },
          "first_reply_target_seconds": {
            "anyOf": [
              {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "next_reply_target_seconds": {
            "anyOf": [
              {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "resolution_target_seconds": {
            "anyOf": [
              {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "answer_target_seconds": {
            "description": "Phone: callers waiting for a human must be answered within this many seconds (office hours only, when the policy has them).",
            "anyOf": [
              {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "answer_target_percent": {
            "description": "Phone: goal for the share of calls answered within the target.",
            "anyOf": [
              {
                "type": "integer",
                "minimum": 1,
                "maximum": 100
              },
              {
                "type": "null"
              }
            ]
          },
          "answer_count_mode": {
            "description": "Phone: all_offered counts callers who were never answered as missed; answered_only grades answered calls only.",
            "type": "string",
            "enum": [
              "all_offered",
              "answered_only"
            ]
          },
          "answer_short_abandon_seconds": {
            "description": "Phone: leave out callers who hang up within this many seconds of waiting.",
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "CreateVocCategoryDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CreateVocCategoryDtoInput",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 60
          },
          "description": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "name"
        ]
      },
      "UpdateCategoryDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdateCategoryDtoInput",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 60
          },
          "description": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "FileUploadDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/FileUploadDtoInput",
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "file": {
                "type": "string",
                "format": "binary",
                "contentEncoding": "binary"
              }
            },
            "required": [
              "file"
            ]
          },
          {
            "type": "null"
          }
        ]
      },
      "PhoneHandoffReason": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/PhoneHandoffReasonInput",
        "type": "string",
        "enum": [
          "ai_initiated",
          "no_agent_assigned",
          "agent_unavailable",
          "caller_requested",
          "timeout",
          "unknown"
        ]
      },
      "RetranslateMacroDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/RetranslateMacroDtoInput",
        "type": "object",
        "properties": {
          "languages": {
            "minItems": 1,
            "maxItems": 10,
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[a-z]{2,3}$"
            }
          }
        }
      },
      "CreateStructuredFieldGroupDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CreateStructuredFieldGroupDtoInput",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "description": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 1000
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "name"
        ],
        "additionalProperties": false
      },
      "UpdateStructuredFieldGroupDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdateStructuredFieldGroupDtoInput",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "description": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 1000
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "StructuredFieldTypeDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/StructuredFieldTypeDto",
        "type": "string",
        "enum": [
          "enum",
          "text",
          "number",
          "boolean",
          "date",
          "user",
          "team",
          "tag"
        ]
      },
      "StructuredFieldShowWhenDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/StructuredFieldShowWhenDtoInput",
        "type": "object",
        "properties": {
          "field_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "values": {
            "minItems": 1,
            "maxItems": 100,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          }
        },
        "required": [
          "field_id",
          "values"
        ]
      },
      "CreateStructuredFieldDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CreateStructuredFieldDtoInput",
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "pattern": "^[a-z0-9_]{1,100}$"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1000
          },
          "type": {
            "$ref": "#/components/schemas/StructuredFieldTypeDto"
          },
          "show_when": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/StructuredFieldShowWhenDto"
              },
              {
                "type": "null"
              }
            ]
          },
          "group_id": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "key",
          "name",
          "description"
        ],
        "additionalProperties": false
      },
      "UpdateStructuredFieldDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdateStructuredFieldDtoInput",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1000
          },
          "show_when": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/StructuredFieldShowWhenDto"
              },
              {
                "type": "null"
              }
            ]
          },
          "group_id": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "CreateStructuredFieldVariantDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CreateStructuredFieldVariantDtoInput",
        "type": "object",
        "properties": {
          "value": {
            "type": "string",
            "pattern": "^[a-z0-9_]{1,100}$"
          },
          "variant_display_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "variant_description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1000
          },
          "parent_id": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "value",
          "variant_display_name",
          "variant_description"
        ]
      },
      "UpdateStructuredFieldVariantDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdateStructuredFieldVariantDtoInput",
        "type": "object",
        "properties": {
          "variant_display_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "variant_description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1000
          },
          "parent_id": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "SessionStructuredFieldValueInputDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SessionStructuredFieldValueInputDtoInput",
        "type": "object",
        "properties": {
          "field_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "field_key": {
            "type": "string",
            "minLength": 1
          },
          "value": {
            "anyOf": [
              {
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 5000
                  },
                  {
                    "type": "number"
                  },
                  {
                    "type": "boolean"
                  }
                ]
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "value"
        ]
      },
      "SetSessionStructuredFieldValuesDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SetSessionStructuredFieldValuesDtoInput",
        "type": "object",
        "properties": {
          "values": {
            "maxItems": 50,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SessionStructuredFieldValueInputDto"
            }
          }
        },
        "required": [
          "values"
        ]
      },
      "CompanyOwnerInput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CompanyOwnerInputInput",
        "type": "object",
        "properties": {
          "id": {
            "description": "OpenCX user id of the owning teammate",
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "email": {
            "description": "Email of the owning teammate, matched case-insensitively against this organization’s members",
            "type": "string",
            "format": "email",
            "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
          }
        }
      },
      "UpsertCompanyDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpsertCompanyDtoInput",
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "minLength": 1
          },
          "name": {
            "type": "string",
            "minLength": 1
          },
          "custom_data": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "number"
                },
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "owner": {
            "description": "Set the owning teammate while creating or updating. Omit to leave ownership unchanged; null clears it.",
            "anyOf": [
              {
                "$ref": "#/components/schemas/CompanyOwnerInput"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "external_id"
        ]
      },
      "BulkLinkContactsDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/BulkLinkContactsDtoInput",
        "type": "object",
        "properties": {
          "links": {
            "minItems": 1,
            "maxItems": 100,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "contact_id": {
                  "description": "The OpenCX contact id, if you already hold it",
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "contact_email": {
                  "description": "Look the contact up by email instead of id",
                  "type": "string",
                  "format": "email",
                  "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                },
                "contact_phone": {
                  "description": "Look the contact up by phone instead of id. `+15551234567` and `15551234567` both match",
                  "type": "string",
                  "minLength": 1
                },
                "external_id": {
                  "type": "string",
                  "minLength": 1,
                  "description": "The company to link, by the same `external_id` you upserted it with"
                }
              },
              "required": [
                "external_id"
              ]
            }
          }
        },
        "required": [
          "links"
        ]
      },
      "LinkContactCompanyDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/LinkContactCompanyDtoInput",
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": [
          "external_id"
        ]
      },
      "SetCompanyOwnerDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SetCompanyOwnerDtoInput",
        "type": "object",
        "properties": {
          "owner": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CompanyOwnerInput"
              },
              {
                "type": "null"
              }
            ],
            "description": "The teammate who owns this account. Null leaves the company unowned."
          }
        },
        "required": [
          "owner"
        ]
      },
      "SearchCompaniesInput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SearchCompaniesInputInput",
        "type": "object",
        "properties": {
          "filters": {
            "type": "object",
            "properties": {
              "owner_ids": {
                "description": "Owned by any of these teammates (OpenCX user ids). ORed with `unowned`.",
                "type": "array",
                "items": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              },
              "unowned": {
                "description": "Include companies nobody owns.",
                "type": "boolean",
                "const": true
              },
              "custom_data": {
                "description": "Attribute conditions, all of which must hold. `before` / `after` take a YYYY-MM-DD day and match attributes holding an ISO date or timestamp, or a Unix timestamp in seconds or milliseconds, compared on the UTC day; the day itself matches neither.",
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "key": {
                      "type": "string",
                      "minLength": 1
                    },
                    "op": {
                      "type": "string",
                      "enum": [
                        "exists",
                        "not_exists",
                        "eq",
                        "neq",
                        "contains",
                        "before",
                        "after"
                      ]
                    },
                    "value": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "key",
                    "op"
                  ]
                }
              }
            }
          },
          "search": {
            "description": "Case-insensitive substring of the company name or external id.",
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "ordering": {
            "type": "object",
            "properties": {
              "field": {
                "description": "Default: `created_at`.",
                "type": "string",
                "enum": [
                  "name",
                  "created_at",
                  "contacts_count"
                ]
              },
              "direction": {
                "description": "Default: `asc` for `name`, `desc` otherwise.",
                "type": "string",
                "enum": [
                  "asc",
                  "desc"
                ]
              }
            }
          },
          "page": {
            "description": "Page number, starting at 1. Default: 1.",
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "limit": {
            "description": "Max 200. Default: 50.",
            "type": "integer",
            "minimum": 1,
            "maximum": 200
          }
        }
      },
      "ContactStructuredFieldValueInputDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ContactStructuredFieldValueInputDtoInput",
        "$ref": "#/components/schemas/SessionStructuredFieldValueInputDto"
      },
      "SetContactStructuredFieldValuesDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SetContactStructuredFieldValuesDtoInput",
        "type": "object",
        "properties": {
          "values": {
            "maxItems": 50,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContactStructuredFieldValueInputDto"
            }
          }
        },
        "required": [
          "values"
        ]
      },
      "UpdateCsatSettingsDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdateCsatSettingsDtoInput",
        "type": "object",
        "properties": {
          "web_enabled": {
            "description": "Whether CSAT collection is enabled for web channel",
            "type": "boolean"
          },
          "email_enabled": {
            "description": "Whether CSAT collection is enabled for email channel",
            "type": "boolean"
          },
          "phone_enabled": {
            "description": "Whether CSAT collection is enabled for phone channel",
            "type": "boolean"
          },
          "whatsapp_enabled": {
            "description": "Whether CSAT collection is enabled for WhatsApp channel",
            "type": "boolean"
          },
          "sms_enabled": {
            "description": "Whether CSAT collection is enabled for SMS channel",
            "type": "boolean"
          },
          "slack_enabled": {
            "description": "Whether CSAT collection is enabled for Slack channel",
            "type": "boolean"
          },
          "api_enabled": {
            "description": "Whether CSAT collection is enabled for API channel",
            "type": "boolean"
          },
          "web_voice_enabled": {
            "description": "Whether CSAT collection is enabled for web voice channel",
            "type": "boolean"
          },
          "instagram_enabled": {
            "description": "Whether CSAT collection is enabled for Instagram channel",
            "type": "boolean"
          },
          "messenger_enabled": {
            "description": "Whether CSAT collection is enabled for Facebook Messenger channel",
            "type": "boolean"
          },
          "custom_message": {
            "description": "Custom message to display with CSAT request",
            "type": "string"
          },
          "auto_send_on_close": {
            "description": "Whether to automatically send CSAT after session closes",
            "type": "boolean"
          },
          "send_delay_minutes": {
            "description": "Delay in minutes before sending CSAT after session closes",
            "type": "number"
          },
          "resend_policy": {
            "description": "How often the same session may be surveyed: once_per_session (default, one survey ever), once_per_close (one per closure, so a reopened session can be surveyed again), once_until_answered (re-ask after resend_after_days until the customer scores it), or always (survey every close, even one the customer already rated)",
            "type": "string",
            "enum": [
              "always",
              "once_per_close",
              "once_per_session",
              "once_until_answered"
            ]
          },
          "resend_after_days": {
            "description": "Days to wait before re-asking an unanswered survey. Only used when resend_policy is once_until_answered",
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "rescore_window_hours": {
            "description": "How long (hours, from the first submit) a customer may change their score. Null = unlimited re-rating, 0 = locked as soon as the first score lands. Staff submits are always exempt",
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "channel_config": {
            "description": "Per-channel overrides keyed by channel (e.g. { \"whatsapp\": { \"rating_style\": \"emoji\" } }). Replaces the whole map, so send the channels you want to keep",
            "type": "object",
            "propertyNames": {
              "$ref": "#/components/schemas/SessionChannel"
            },
            "additionalProperties": {
              "type": "object",
              "properties": {
                "rating_style": {
                  "description": "How the 1-5 scale is drawn on channels that render it in-conversation",
                  "type": "string",
                  "enum": [
                    "stars",
                    "emoji",
                    "numbers"
                  ]
                },
                "rating_order": {
                  "description": "Whether the scale is listed best-first (desc, default) or worst-first (asc)",
                  "type": "string",
                  "enum": [
                    "desc",
                    "asc"
                  ]
                },
                "custom_message": {
                  "description": "Survey question for this channel. Falls back to the org-wide custom_message",
                  "type": "string"
                }
              }
            }
          },
          "web_template_html": {
            "description": "Full-HTML template for the public CSAT feedback page. Null/empty clears it (default page).",
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "email_template_html": {
            "description": "Full-HTML template for the CSAT request email. Null/empty clears it (default email).",
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "email_template_subject": {
            "description": "Subject line for the custom CSAT request email. Null falls back to the default.",
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "CreateEmailTemplateBodyDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CreateEmailTemplateBodyDtoInput",
        "type": "object",
        "properties": {
          "body": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "subject": {
            "type": "string"
          },
          "variable_defaults": {
            "anyOf": [
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": "string"
                }
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "body",
          "name",
          "subject"
        ]
      },
      "CreateGroupCategoryDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CreateGroupCategoryDtoInput",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          }
        },
        "required": [
          "name"
        ]
      },
      "AddUserToGroupDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/AddUserToGroupDtoInput",
        "type": "object",
        "properties": {
          "userId": {
            "type": "number"
          },
          "groupId": {
            "type": "string"
          }
        },
        "required": [
          "userId"
        ]
      },
      "CreateGroupDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CreateGroupDtoInput",
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "category_id": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              {
                "type": "null"
              }
            ]
          },
          "description": {
            "type": "string"
          },
          "is_support_enabled": {
            "type": "boolean"
          },
          "support_office_hours_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "support_assignment_strategy": {
            "type": "string",
            "enum": [
              "least-busy",
              "round-robin",
              "unassigned"
            ]
          },
          "call_wrap_up_seconds": {
            "description": "Team wrap-up in seconds. Null inherits the organization setting; zero disables wrap-up.",
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 3600
              },
              {
                "type": "null"
              }
            ]
          },
          "telephony_pacing_enabled": {
            "description": "Queue calls for this team and offer each call to one available agent at a time.",
            "type": "boolean"
          },
          "telephony_ring_seconds": {
            "type": "integer",
            "minimum": 10,
            "maximum": 120
          },
          "telephony_queue_wait_seconds": {
            "type": "integer",
            "minimum": 30,
            "maximum": 3600
          },
          "telephony_distribution": {
            "type": "string",
            "enum": [
              "fewest_answered_today",
              "longest_available"
            ]
          },
          "phone_sla_policy_id": {
            "description": "SLA policy whose phone answer-time target grades calls waiting in this team. Null uses the organization default.",
            "anyOf": [
              {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              {
                "type": "null"
              }
            ]
          },
          "call_recording_enabled": {
            "description": "Record calls answered by this team. When off, answering does not start a recording; one the phone agent or call flow already started keeps running.",
            "type": "boolean"
          },
          "call_languages": {
            "description": "Languages spoken on calls this team answers (language codes). Live transcripts of those calls stay in these languages; empty uses the organization default.",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "auto_assign_interval_seconds": {
            "description": "Seconds between automatic assignments to the same agent under the least-busy strategy: 0 turns pacing off, otherwise 15 to 3600.",
            "type": "integer",
            "minimum": 0,
            "maximum": 3600
          }
        },
        "required": [
          "name"
        ]
      },
      "CreateWebCallDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CreateWebCallDtoInput",
        "type": "object",
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
            "description": "Reuse for retries of the same call creation request."
          },
          "contactId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "Verified contact belonging to your organization. Resolve this on your server."
          },
          "destination": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "agent"
                  },
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  }
                },
                "required": [
                  "type",
                  "id"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "team"
                  },
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  }
                },
                "required": [
                  "type",
                  "id"
                ],
                "additionalProperties": false
              }
            ]
          },
          "maxDurationSeconds": {
            "default": 1800,
            "type": "integer",
            "minimum": 60,
            "maximum": 3600
          }
        },
        "required": [
          "requestId",
          "contactId",
          "destination"
        ],
        "additionalProperties": false
      },
      "MiniAppIcon": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/MiniAppIcon",
        "type": "string",
        "enum": [
          "ChartBar",
          "ChartBarHorizontal",
          "ChartLine",
          "ChartLineUp",
          "ChartPie",
          "ChartDonut",
          "ChartScatter",
          "ChartPolar",
          "TrendUp",
          "TrendDown",
          "Graph",
          "Table",
          "ListBullets",
          "Kanban",
          "Funnel",
          "Gauge",
          "Pulse",
          "Percent",
          "Calculator",
          "Target",
          "Crosshair",
          "Timer",
          "Clock",
          "CalendarBlank",
          "Users",
          "UsersThree",
          "User",
          "UserCircle",
          "IdentificationBadge",
          "Headset",
          "Handshake",
          "Chat",
          "ChatsTeardrop",
          "Envelope",
          "Phone",
          "Globe",
          "Megaphone",
          "PaperPlaneTilt",
          "Bell",
          "Star",
          "Heart",
          "Smiley",
          "ThumbsUp",
          "Warning",
          "ShieldCheck",
          "Trophy",
          "Medal",
          "Flag",
          "Fire",
          "Rocket",
          "Lightning",
          "Sparkle",
          "Robot",
          "Brain",
          "MagicWand",
          "Atom",
          "Lightbulb",
          "Money",
          "CurrencyDollar",
          "Coins",
          "CreditCard",
          "Receipt",
          "ShoppingCart",
          "Package",
          "Truck",
          "Storefront",
          "Buildings",
          "MapPin",
          "Tag",
          "Bookmark",
          "Ticket",
          "Database",
          "Stack",
          "Cube",
          "Wrench",
          "Gear",
          "Flask",
          "FileText",
          "ClipboardText",
          "Notebook",
          "SquaresFour",
          "TreeStructure",
          "Eye",
          "Binoculars",
          "Compass",
          "Scales",
          "Question",
          "Info"
        ]
      },
      "CreateMiniAppDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CreateMiniAppDtoInput",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "description": {
            "type": "string",
            "maxLength": 2000
          },
          "icon": {
            "$ref": "#/components/schemas/MiniAppIcon"
          }
        },
        "required": [
          "name"
        ]
      },
      "SubmitMiniAppDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SubmitMiniAppDtoInput",
        "type": "object",
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "source": {
            "type": "string",
            "minLength": 1
          },
          "code": {
            "type": "string",
            "minLength": 1
          },
          "css": {
            "type": "string"
          },
          "target_surface": {
            "type": "string",
            "enum": [
              "inbox",
              "dashboard"
            ]
          },
          "declared_network": {
            "maxItems": 20,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "origin": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 255
                },
                "reason": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 300
                }
              },
              "required": [
                "origin",
                "reason"
              ]
            }
          },
          "template": {
            "type": "string",
            "maxLength": 100
          },
          "template_version": {
            "type": "string",
            "maxLength": 100
          }
        },
        "required": [
          "app_id",
          "source",
          "code",
          "css"
        ]
      },
      "UpdateMiniAppDetailsDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdateMiniAppDetailsDtoInput",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "description": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 2000
              },
              {
                "type": "null"
              }
            ]
          },
          "enabled_channels": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SessionChannel"
            }
          },
          "icon": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/MiniAppIcon"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "DefaultOfficeHoursInputDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/DefaultOfficeHoursInputDtoInput",
        "type": "object",
        "properties": {
          "iana_timezone": {
            "type": "string",
            "description": "IANA timezone for the default schedule (e.g. \"America/New_York\", \"Europe/London\", \"Asia/Tokyo\")"
          },
          "exceptions": {
            "description": "Omit to preserve existing exceptions; send [] to clear them",
            "maxItems": 200,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OfficeHoursExceptionDto"
            }
          },
          "shifts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "day_of_week": {
                  "type": "string",
                  "enum": [
                    "everyday",
                    "friday",
                    "friday_and_saturday",
                    "monday",
                    "monday_to_friday",
                    "saturday",
                    "sunday",
                    "sunday_and_monday",
                    "sunday_to_thursday",
                    "thursday",
                    "tuesday",
                    "wednesday"
                  ],
                  "description": "Day(s) of week: \"monday\", \"tuesday\", \"wednesday\", \"thursday\", \"friday\", \"saturday\", \"sunday\", \"everyday\", \"monday_to_friday\", \"sunday_to_thursday\", \"friday_and_saturday\", \"sunday_and_monday\""
                },
                "start_time": {
                  "type": "string",
                  "description": "Start time in HH:mm:ss format (e.g. \"09:00:00\")"
                },
                "end_time": {
                  "type": "string",
                  "description": "End time in HH:mm:ss format (e.g. \"17:00:00\")"
                }
              },
              "required": [
                "day_of_week",
                "start_time",
                "end_time"
              ]
            },
            "description": "Time blocks when support is available. Replaces all existing default shifts. Use day ranges like \"monday_to_friday\" for convenience."
          }
        },
        "required": [
          "iana_timezone",
          "shifts"
        ]
      },
      "UpdateAgentWorkflowsDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdateAgentWorkflowsDtoInput",
        "type": "object",
        "properties": {
          "workflowIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Logical workflow UUIDs to enable for this agent"
          }
        },
        "required": [
          "workflowIds"
        ]
      },
      "UpdateKnowledgeSourcesDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdateKnowledgeSourcesDtoInput",
        "type": "object",
        "properties": {
          "instructionMode": {
            "description": "Deprecated; omit. \"all\" (with empty instructionIds and directoryIds) selects every instruction folder and every instruction outside a folder available now. New folders and new instructions outside a folder are not selected.",
            "type": "string",
            "enum": [
              "all",
              "selected"
            ]
          },
          "knowledgeMode": {
            "description": "Deprecated; omit. \"all\" (with empty knowledge selections) selects every knowledge folder available now. New folders are not selected.",
            "type": "string",
            "enum": [
              "all",
              "selected"
            ]
          },
          "instructionIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "IDs of individual instructions to select (outside of selected directories)"
          },
          "directoryIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "IDs of directories to select (all instructions in these directories are included)"
          },
          "knowledgeItemIds": {
            "description": "IDs of individual knowledge items to search. Omit to leave knowledge selections unchanged.",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "knowledgeFolderKeys": {
            "description": "Canonical knowledge folder keys to search. Omit to leave knowledge selections unchanged.",
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 500
            }
          }
        },
        "required": [
          "instructionIds",
          "directoryIds"
        ]
      },
      "MakeOutboundCallDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/MakeOutboundCallDtoInput",
        "type": "object",
        "properties": {
          "phoneAgentId": {
            "type": "string"
          },
          "contact": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  }
                },
                "required": [
                  "id"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "phoneNumber": {
                    "type": "string"
                  }
                },
                "required": [
                  "phoneNumber"
                ]
              }
            ]
          },
          "sessionCustomData": {
            "description": "Custom attributes saved on the call session before the call starts, so workflows and webhooks that fire at call start already see them. Also surfaced to the AI agent as session context. Equivalent to the X-OPENCX-SESSION-CUSTOM-DATA header on inbound calls.",
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "number"
                },
                {
                  "type": "boolean"
                }
              ]
            }
          },
          "extraInstructions": {
            "description": "Extra instructions for the AI agent, scoped to this call only. Appended to the agent instructions in a clearly-scoped block — they complement, never replace, the agent prompt.",
            "type": "string",
            "maxLength": 10000
          },
          "parentSessionId": {
            "description": "Open the call as a sub-session of this session. The call session then shows under it in the inbox and carries it as the parent in Call Finished workflows. The session must belong to the same organization; otherwise the request fails with `parent_session_not_found`.",
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          }
        },
        "required": [
          "phoneAgentId",
          "contact"
        ]
      },
      "RedactMessageDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/RedactMessageDtoInput",
        "type": "object",
        "properties": {
          "messageId": {
            "type": "string",
            "minLength": 1,
            "description": "The message UUID to be redacted"
          },
          "reason": {
            "description": "Optional reason for redaction",
            "type": "string"
          }
        },
        "required": [
          "messageId"
        ]
      },
      "RedactSessionDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/RedactSessionDtoInput",
        "type": "object",
        "properties": {
          "sessionId": {
            "type": "string",
            "minLength": 1,
            "description": "The session UUID whose messages will be redacted"
          },
          "reason": {
            "description": "Optional reason for redaction",
            "type": "string"
          }
        },
        "required": [
          "sessionId"
        ]
      },
      "MacroOptionInputDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/MacroOptionInputDtoInput",
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 20
          },
          "type": {
            "$ref": "#/components/schemas/MessageOptionType"
          }
        },
        "required": [
          "label",
          "type"
        ]
      },
      "SkipSequenceStepBody": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SkipSequenceStepBodyInput",
        "type": "object",
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "next_pending",
              "next_channel",
              "specific_step"
            ]
          },
          "channel": {
            "description": "Required for next_channel. Phone uses voice.",
            "type": "string",
            "enum": [
              "whatsapp",
              "voice",
              "email"
            ]
          },
          "step_index": {
            "description": "Required for specific_step; zero-based.",
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2000
          },
          "idempotency_key": {
            "description": "Reuse for retries of a next-step request in this enrollment. Specific-step skips are always idempotent.",
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          }
        },
        "required": [
          "mode"
        ]
      },
      "CreateWhatsAppTemplateDraftButtonDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CreateWhatsAppTemplateDraftButtonDtoInput",
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "QUICK_REPLY"
              },
              "text": {
                "type": "string",
                "minLength": 1,
                "maxLength": 25,
                "description": "The label, 25 chars."
              }
            },
            "required": [
              "type",
              "text"
            ]
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "URL"
              },
              "text": {
                "type": "string",
                "minLength": 1,
                "maxLength": 25,
                "description": "The label, 25 chars."
              },
              "url": {
                "type": "string",
                "minLength": 1,
                "maxLength": 2000,
                "description": "Static, or ending in exactly one {{1}} for a per-message suffix (https://open.cx/track/{{1}}). A suffix button needs a step binding to send."
              },
              "url_example": {
                "description": "REQUIRED when the url ends in {{1}}: the full url with a realistic suffix, for review. Omit for a static url.",
                "type": "string",
                "minLength": 1,
                "maxLength": 2000
              }
            },
            "required": [
              "type",
              "text",
              "url"
            ]
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "PHONE_NUMBER"
              },
              "text": {
                "type": "string",
                "minLength": 1,
                "maxLength": 25,
                "description": "The label, 25 chars."
              },
              "phone_number": {
                "type": "string",
                "minLength": 1,
                "maxLength": 20,
                "description": "E.164, e.g. +962790000000."
              }
            },
            "required": [
              "type",
              "text",
              "phone_number"
            ]
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "COPY_CODE"
              },
              "example": {
                "type": "string",
                "minLength": 1,
                "maxLength": 15,
                "description": "A sample coupon, 15 chars. The real code is bound per message on the step."
              }
            },
            "required": [
              "type",
              "example"
            ]
          }
        ]
      },
      "CreateWhatsAppTemplateDraftDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CreateWhatsAppTemplateDraftDtoInput",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512,
            "pattern": "^[a-z0-9_]+$"
          },
          "language": {
            "type": "string",
            "minLength": 1,
            "description": "BCP-47 code, e.g. en_US, ar, ar_SA."
          },
          "category": {
            "type": "string",
            "enum": [
              "UTILITY",
              "MARKETING",
              "AUTHENTICATION"
            ],
            "description": "UTILITY for a follow-up on something the person already contacted you about; MARKETING for a promotion (opt-out gated, worse delivery). Meta re-categorizes what it disagrees with."
          },
          "body_text": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024,
            "description": "Placeholders as {{1}}, {{2}} in order, or {{named}}. Never mix the two styles."
          },
          "body_variable_examples": {
            "default": [],
            "description": "A realistic sample value per placeholder, in body order. Meta REJECTS templates whose placeholders have no examples, so an empty list with a placeholder-bearing body is refused here rather than hours later.",
            "maxItems": 20,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "header_text": {
            "description": "Plain text only, no placeholders.",
            "type": "string",
            "minLength": 1,
            "maxLength": 60
          },
          "footer_text": {
            "type": "string",
            "minLength": 1,
            "maxLength": 60
          },
          "buttons": {
            "default": [],
            "description": "In display order. Quick replies must sit together — all before or all after the other kinds (Meta groups them). Up to 10.",
            "maxItems": 10,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateWhatsAppTemplateDraftButtonDto"
            }
          },
          "message_send_ttl_seconds": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Message validity period in seconds. Authentication: 30–900, Utility: 30–43200, Marketing: 43200–2592000. -1 = explicit 30-day TTL (authentication/utility only)."
          },
          "waba_id": {
            "description": "Only needed when the org has more than one WABA; otherwise resolved.",
            "type": "string"
          }
        },
        "required": [
          "name",
          "language",
          "category",
          "body_text"
        ]
      },
      "SetSequenceStepPersonalizationDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SetSequenceStepPersonalizationDtoInput",
        "type": "object",
        "properties": {
          "content": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "email"
                  },
                  "subject": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 998
                  },
                  "html": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 65536
                  },
                  "text": {
                    "description": "Plain-text alternative. Derived from html when omitted.",
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "type",
                  "subject",
                  "html"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "voice_call"
                  },
                  "extra_instructions": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 10000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "type",
                  "extra_instructions"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "whatsapp_template"
                  },
                  "template_name": {
                    "type": "string",
                    "minLength": 1
                  },
                  "template_language": {
                    "type": "string",
                    "minLength": 1
                  },
                  "values": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9_]+$"
                    },
                    "additionalProperties": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 1024
                    },
                    "description": "Literal body values keyed by positional index or exact parameter name; cover every body parameter with no extras."
                  }
                },
                "required": [
                  "type",
                  "template_name",
                  "template_language",
                  "values"
                ]
              }
            ]
          }
        },
        "required": [
          "content"
        ]
      },
      "ExitSequenceContactDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ExitSequenceContactDtoInput",
        "type": "object",
        "properties": {
          "contact_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "email": {
            "type": "string",
            "minLength": 1,
            "maxLength": 320
          },
          "phone_number": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50
          },
          "whatsapp_user_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "reason": {
            "description": "Why they are being removed, in the operator's own words. Optional: a CRM firing \"stop contacting this lead\" has no reason to send, and refusing the removal over a missing note would be the wrong way to fail. When given, it is the one thing that cannot be backfilled - it is what later teaches the criteria, the exclusion list, and the source.",
            "type": "string",
            "maxLength": 500
          }
        }
      },
      "UpdateSequenceContactDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdateSequenceContactDtoInput",
        "type": "object",
        "properties": {
          "display_name": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ]
          },
          "phone": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 50
              },
              {
                "type": "null"
              }
            ]
          },
          "email": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 320
              },
              {
                "type": "null"
              }
            ]
          },
          "whatsapp_user_id": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 64
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "EnrichSequenceContactsDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/EnrichSequenceContactsDtoInput",
        "type": "object",
        "properties": {
          "scope": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "batch_key"
                  },
                  "batch_key": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  }
                },
                "required": [
                  "kind",
                  "batch_key"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "contact_ids"
                  },
                  "contact_ids": {
                    "minItems": 1,
                    "maxItems": 10000,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                    }
                  }
                },
                "required": [
                  "kind",
                  "contact_ids"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "all_candidates"
                  }
                },
                "required": [
                  "kind"
                ]
              }
            ],
            "description": "Which people to enrich: a labeled wave (batch_key), explicit contact_ids, or all_candidates."
          },
          "enrichers": {
            "description": "Default: every implemented enricher.",
            "minItems": 1,
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "opencx"
              ]
            }
          },
          "wait": {
            "description": "Hold the response until the run finishes (up to ~50s) and return it, so a sample can be awaited instead of polled. IGNORED when the scope is larger than 50 people — dispatch those and let the dashboard show progress.",
            "type": "boolean"
          }
        },
        "required": [
          "scope"
        ]
      },
      "JudgeSequenceContactsDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/JudgeSequenceContactsDtoInput",
        "type": "object",
        "properties": {
          "scope": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "batch_key"
                  },
                  "batch_key": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  }
                },
                "required": [
                  "kind",
                  "batch_key"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "contact_ids"
                  },
                  "contact_ids": {
                    "minItems": 1,
                    "maxItems": 10000,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                    }
                  }
                },
                "required": [
                  "kind",
                  "contact_ids"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "all_candidates"
                  }
                },
                "required": [
                  "kind"
                ]
              }
            ]
          },
          "criteria": {
            "description": "Omitted: judge with the campaign's stored criteria. Provided: judge with these AND save them as the campaign's new current criteria.",
            "type": "object",
            "properties": {
              "must": {
                "maxItems": 20,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "label": {
                      "type": "string",
                      "minLength": 2,
                      "maxLength": 60,
                      "description": "A few words naming this criterion, shown in the dashboard — \"Recent invoicing complaint\", \"Business account\". Not a sentence."
                    },
                    "text": {
                      "type": "string",
                      "minLength": 3,
                      "maxLength": 500,
                      "description": "The full instruction the judge reads. Name the boundary explicitly — what counts and what does not. Never shown in the table."
                    }
                  },
                  "required": [
                    "label",
                    "text"
                  ]
                }
              },
              "nice": {
                "maxItems": 20,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "label": {
                      "type": "string",
                      "minLength": 2,
                      "maxLength": 60,
                      "description": "A few words naming this criterion, shown in the dashboard — \"Recent invoicing complaint\", \"Business account\". Not a sentence."
                    },
                    "text": {
                      "type": "string",
                      "minLength": 3,
                      "maxLength": 500,
                      "description": "The full instruction the judge reads. Name the boundary explicitly — what counts and what does not. Never shown in the table."
                    },
                    "grade": {
                      "type": "string",
                      "enum": [
                        "high",
                        "medium",
                        "low"
                      ]
                    }
                  },
                  "required": [
                    "label",
                    "text",
                    "grade"
                  ]
                }
              }
            },
            "required": [
              "must",
              "nice"
            ]
          },
          "wait": {
            "description": "Hold the response until the run finishes (up to ~50s) and return it, so a sample can be awaited instead of polled. IGNORED when the scope is larger than 50 people — dispatch those and let the dashboard show progress.",
            "type": "boolean"
          }
        },
        "required": [
          "scope"
        ]
      },
      "CreateSequenceDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CreateSequenceDtoInput",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "steps": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "channel": {
                      "type": "string",
                      "const": "whatsapp"
                    },
                    "content": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "whatsapp_template"
                        },
                        "template_name": {
                          "type": "string",
                          "minLength": 1
                        },
                        "template_language": {
                          "type": "string",
                          "minLength": 1
                        },
                        "variables": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "object",
                            "properties": {
                              "source": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200,
                                "description": "A recipient column ('display_name', 'phone', 'email') or the exact name of a key in the person's attached data (extra_data). Those three names always read the column — a key spelled the same is unreachable; any other string reads the attached data, matched verbatim as a top-level key. A missing or empty value falls to `fallback`, and with no fallback the person parks (needs_data)."
                              },
                              "fallback": {
                                "type": "string"
                              },
                              "type": {
                                "description": "Optional. Applies to attached-data sources only — ignored on the three columns. How to read the value: string, number, boolean, date, string[] or number[] — the same vocabulary as People-table columns. Absent: text and numbers pass through, anything else counts as missing. Declared: text is parsed where it is unambiguous (\"250\" as a number or a string, \"true\" as a boolean, an ISO-shaped date such as \"2026-03-12\" — other date spellings and epoch numbers are missing), a date renders as a plain day in the person's timezone, a list needs an actual list in the data and joins with commas, dropping items it cannot read, and a value that cannot be read as the declared type counts as missing.",
                                "type": "string",
                                "enum": [
                                  "string",
                                  "number",
                                  "boolean",
                                  "date",
                                  "string[]",
                                  "number[]"
                                ]
                              }
                            },
                            "required": [
                              "source"
                            ]
                          },
                          "description": "Body bindings keyed by positional index (\"1\", \"2\") or exact parameter name (\"first_name\")."
                        },
                        "buttons": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string",
                            "pattern": "^[0-9]$"
                          },
                          "additionalProperties": {
                            "type": "object",
                            "properties": {
                              "source": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200,
                                "description": "A recipient column ('display_name', 'phone', 'email') or the exact name of a key in the person's attached data (extra_data). Those three names always read the column — a key spelled the same is unreachable; any other string reads the attached data, matched verbatim as a top-level key. A missing or empty value falls to `fallback`, and with no fallback the person parks (needs_data)."
                              },
                              "fallback": {
                                "type": "string"
                              },
                              "type": {
                                "description": "Optional. Applies to attached-data sources only — ignored on the three columns. How to read the value: string, number, boolean, date, string[] or number[] — the same vocabulary as People-table columns. Absent: text and numbers pass through, anything else counts as missing. Declared: text is parsed where it is unambiguous (\"250\" as a number or a string, \"true\" as a boolean, an ISO-shaped date such as \"2026-03-12\" — other date spellings and epoch numbers are missing), a date renders as a plain day in the person's timezone, a list needs an actual list in the data and joins with commas, dropping items it cannot read, and a value that cannot be read as the declared type counts as missing.",
                                "type": "string",
                                "enum": [
                                  "string",
                                  "number",
                                  "boolean",
                                  "date",
                                  "string[]",
                                  "number[]"
                                ]
                              }
                            },
                            "required": [
                              "source"
                            ]
                          }
                        }
                      },
                      "required": [
                        "type",
                        "template_name",
                        "template_language",
                        "variables"
                      ]
                    },
                    "delay_minutes": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 129600
                    }
                  },
                  "required": [
                    "channel",
                    "content",
                    "delay_minutes"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "channel": {
                      "type": "string",
                      "const": "voice"
                    },
                    "content": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "voice_call"
                        },
                        "extra_instructions": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 8000
                        },
                        "variables": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 64
                          },
                          "additionalProperties": {
                            "type": "object",
                            "properties": {
                              "source": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200,
                                "description": "A recipient column ('display_name', 'phone', 'email') or the exact name of a key in the person's attached data (extra_data). Those three names always read the column — a key spelled the same is unreachable; any other string reads the attached data, matched verbatim as a top-level key. A missing or empty value falls to `fallback`, and with no fallback the person parks (needs_data)."
                              },
                              "fallback": {
                                "type": "string"
                              },
                              "type": {
                                "description": "Optional. Applies to attached-data sources only — ignored on the three columns. How to read the value: string, number, boolean, date, string[] or number[] — the same vocabulary as People-table columns. Absent: text and numbers pass through, anything else counts as missing. Declared: text is parsed where it is unambiguous (\"250\" as a number or a string, \"true\" as a boolean, an ISO-shaped date such as \"2026-03-12\" — other date spellings and epoch numbers are missing), a date renders as a plain day in the person's timezone, a list needs an actual list in the data and joins with commas, dropping items it cannot read, and a value that cannot be read as the declared type counts as missing.",
                                "type": "string",
                                "enum": [
                                  "string",
                                  "number",
                                  "boolean",
                                  "date",
                                  "string[]",
                                  "number[]"
                                ]
                              }
                            },
                            "required": [
                              "source"
                            ]
                          }
                        },
                        "handled_by": {
                          "description": "Who takes the call: \"ai\" (default) — the sequence's AI phone agent; \"human\" — a team of agents, dialed for them through the org's own SIP trunk. Omitted = \"ai\", except on an update of a human step, which must say \"ai\" to switch it.",
                          "type": "string",
                          "enum": [
                            "ai",
                            "human"
                          ]
                        },
                        "team_id": {
                          "description": "Human steps: the team whose free agents take the calls. Required when handled_by is \"human\".",
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "trunk_id": {
                          "description": "Human steps: the org's own SIP trunk the calls go out through (see list voice trunks). Required when handled_by is \"human\".",
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                        },
                        "caller_id": {
                          "description": "Human steps: the number shown to the person, in E.164 (+ and digits), one of the workspace's verified numbers. Omitted = the trunk's default.",
                          "type": "string",
                          "pattern": "^\\+[1-9]\\d{6,14}$"
                        },
                        "numbers_per_free_agent": {
                          "description": "Human steps: how many numbers ring at once for each free agent (1–5, default 1). Above 1, a person who picks up while every agent is busy is missed and gets the next step.",
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 5
                        }
                      },
                      "required": [
                        "type"
                      ]
                    },
                    "delay_minutes": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 129600
                    }
                  },
                  "required": [
                    "channel",
                    "content",
                    "delay_minutes"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "channel": {
                      "type": "string",
                      "const": "email"
                    },
                    "content": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "email"
                        },
                        "subject": {
                          "type": "string",
                          "minLength": 1
                        },
                        "html": {
                          "type": "string",
                          "minLength": 1
                        },
                        "text": {
                          "type": "string",
                          "minLength": 1
                        },
                        "variables": {
                          "default": {},
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "object",
                            "properties": {
                              "source": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200,
                                "description": "A recipient column ('display_name', 'phone', 'email') or the exact name of a key in the person's attached data (extra_data). Those three names always read the column — a key spelled the same is unreachable; any other string reads the attached data, matched verbatim as a top-level key. A missing or empty value falls to `fallback`, and with no fallback the person parks (needs_data)."
                              },
                              "fallback": {
                                "type": "string"
                              },
                              "type": {
                                "description": "Optional. Applies to attached-data sources only — ignored on the three columns. How to read the value: string, number, boolean, date, string[] or number[] — the same vocabulary as People-table columns. Absent: text and numbers pass through, anything else counts as missing. Declared: text is parsed where it is unambiguous (\"250\" as a number or a string, \"true\" as a boolean, an ISO-shaped date such as \"2026-03-12\" — other date spellings and epoch numbers are missing), a date renders as a plain day in the person's timezone, a list needs an actual list in the data and joins with commas, dropping items it cannot read, and a value that cannot be read as the declared type counts as missing.",
                                "type": "string",
                                "enum": [
                                  "string",
                                  "number",
                                  "boolean",
                                  "date",
                                  "string[]",
                                  "number[]"
                                ]
                              }
                            },
                            "required": [
                              "source"
                            ]
                          }
                        }
                      },
                      "required": [
                        "type",
                        "subject",
                        "html",
                        "text"
                      ]
                    },
                    "delay_minutes": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 129600
                    }
                  },
                  "required": [
                    "channel",
                    "content",
                    "delay_minutes"
                  ]
                }
              ]
            }
          },
          "settings": {
            "type": "object",
            "properties": {
              "block_active_elsewhere": {
                "type": "boolean"
              },
              "block_contacted_before": {
                "type": "boolean"
              },
              "respect_office_hours": {
                "type": "boolean"
              },
              "office_hours_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "fit_cutoff": {
                "type": "integer",
                "minimum": 75,
                "maximum": 100
              }
            }
          },
          "brief": {
            "description": "What this campaign is about and who it targets, plain text — context for judging and reply handling.",
            "type": "string",
            "maxLength": 10000
          },
          "reply_instructions": {
            "type": "string"
          },
          "criteria": {
            "description": "Qualification checklist: must-haves gate, nice-to-haves rank. Editable later; judge dispatches default to it.",
            "type": "object",
            "properties": {
              "must": {
                "maxItems": 20,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "label": {
                      "type": "string",
                      "minLength": 2,
                      "maxLength": 60,
                      "description": "A few words naming this criterion, shown in the dashboard — \"Recent invoicing complaint\", \"Business account\". Not a sentence."
                    },
                    "text": {
                      "type": "string",
                      "minLength": 3,
                      "maxLength": 500,
                      "description": "The full instruction the judge reads. Name the boundary explicitly — what counts and what does not. Never shown in the table."
                    }
                  },
                  "required": [
                    "label",
                    "text"
                  ]
                }
              },
              "nice": {
                "maxItems": 20,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "label": {
                      "type": "string",
                      "minLength": 2,
                      "maxLength": 60,
                      "description": "A few words naming this criterion, shown in the dashboard — \"Recent invoicing complaint\", \"Business account\". Not a sentence."
                    },
                    "text": {
                      "type": "string",
                      "minLength": 3,
                      "maxLength": 500,
                      "description": "The full instruction the judge reads. Name the boundary explicitly — what counts and what does not. Never shown in the table."
                    },
                    "grade": {
                      "type": "string",
                      "enum": [
                        "high",
                        "medium",
                        "low"
                      ]
                    }
                  },
                  "required": [
                    "label",
                    "text",
                    "grade"
                  ]
                }
              }
            },
            "required": [
              "must",
              "nice"
            ]
          }
        },
        "required": [
          "name"
        ]
      },
      "AddSequenceContactsDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/AddSequenceContactsDtoInput",
        "type": "object",
        "properties": {
          "contacts": {
            "minItems": 1,
            "maxItems": 10000,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "contact_id": {
                  "description": "Enroll a known CRM contact directly — its handles and name fill anything not provided. An id that matches no contact in the org is reported in detail.dropped and the phone/email fallback applies.",
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "phone_number": {
                  "anyOf": [
                    {
                      "type": "string",
                      "maxLength": 50
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "email": {
                  "anyOf": [
                    {
                      "type": "string",
                      "maxLength": 320
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "whatsapp_user_id": {
                  "description": "WhatsApp BSUID (e.g. \"EG.1050912744469111\") — the reachable identity of a phone-hidden contact. Business-scoped: only values this org's own inbound produced can round-trip. Invalid shapes are dropped (reported).",
                  "anyOf": [
                    {
                      "type": "string",
                      "maxLength": 64
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "timezone": {
                  "description": "IANA zone; invalid values are dropped (reported), never guessed.",
                  "anyOf": [
                    {
                      "type": "string",
                      "maxLength": 64
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "display_name": {
                  "anyOf": [
                    {
                      "type": "string",
                      "maxLength": 200
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "avatar_url": {
                  "description": "Picture URL, snapshot onto the row. Must be http(s) — anything else is dropped (reported). Omitted OR null: filled from the linked contact on a new row, left untouched on an existing one — null does not clear a stored picture.",
                  "anyOf": [
                    {
                      "type": "string",
                      "maxLength": 2000
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "extra_data": {
                  "description": "Anything you know about this person — free-form JSON, arbitrary nesting. Stored under their enrichment as `extra_data`: the judge reads it as facts, and People-table columns can project `$.extra_data.*` paths from it. Re-enrolling merges per key (a call that only sends `plan` never wipes `industry`). Rejected per person (`extra_data_too_large`) when the serialized bag exceeds 64,000 characters, or when merging it would grow their stored bag past that (detail.merged=true) — trim and retry just that person; results are index-aligned with the contacts you sent.",
                  "anyOf": [
                    {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "session_custom_data": {
                  "description": "Attributes to stamp on every session this sequence opens for the person — the call session at dial, the reply session when they answer an email or WhatsApp step — as `custom_data`, so workflows that fire on those sessions (Call Finished, Ticket Created) read them straight off the session. Same contract as `sessionCustomData` on the outbound-call endpoint: flat string / number / boolean values, at most 50 keys and 8,000 characters of JSON, no key-name rules. Not for what you know ABOUT the person — that is `extra_data`. Re-enrolling merges per key while they are a candidate or parked (an active or completed person is unchanged, like every other field); rejected per person (`session_custom_data_too_large`) when the bag, or the merge with what they already hold, exceeds the caps — nothing written, trim and retry just that person. Write-only: read it back on the session.",
                  "anyOf": [
                    {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "number"
                          },
                          {
                            "type": "boolean"
                          }
                        ]
                      }
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              }
            }
          },
          "source": {
            "type": "string",
            "enum": [
              "companion",
              "workflow",
              "api",
              "manual",
              "csv"
            ]
          },
          "source_detail": {
            "type": "string",
            "maxLength": 500
          },
          "batch_key": {
            "description": "Wave label (\"csv-aug-refresh\") stamped on every row this call creates or changes — lets enrich/judge scope exactly this wave. Omitted = rows keep their existing key. Never auto-generated.",
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          }
        },
        "required": [
          "contacts"
        ]
      },
      "SetSequenceColumnsDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SetSequenceColumnsDtoInput",
        "type": "object",
        "properties": {
          "columns": {
            "maxItems": 12,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 59,
                  "pattern": "^[a-z0-9_]+$"
                },
                "label": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 60
                },
                "path": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 300,
                  "description": "A jsonpath from the enrichment catalog (e.g. \"$.opencx.data.sessions[*].tags[*]\"), or a \"$.extra_data.*\" path into the caller-supplied bag. Anything else is rejected by name."
                },
                "type": {
                  "description": "REQUIRED for \"$.extra_data.*\" paths — how the cell renders; pick from what you saw in the data. Ignored for catalog paths (the server knows better).",
                  "type": "string",
                  "enum": [
                    "string",
                    "number",
                    "boolean",
                    "date",
                    "string[]",
                    "number[]"
                  ]
                }
              },
              "required": [
                "key",
                "label",
                "path"
              ]
            }
          }
        },
        "required": [
          "columns"
        ]
      },
      "LaunchSequenceInputDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/LaunchSequenceInputDtoInput",
        "type": "object",
        "properties": {
          "regulatory_acknowledged": {
            "description": "True when the user was shown the regulatory notice and confirmed it — recorded with the notice text as shown, purely as a record. Never required; the launch behaves identically without it.",
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "SetSequenceStepsDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SetSequenceStepsDtoInput",
        "type": "object",
        "properties": {
          "steps": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "channel": {
                      "type": "string",
                      "const": "whatsapp"
                    },
                    "content": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "whatsapp_template"
                        },
                        "template_name": {
                          "type": "string",
                          "minLength": 1
                        },
                        "template_language": {
                          "type": "string",
                          "minLength": 1
                        },
                        "variables": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "object",
                            "properties": {
                              "source": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200,
                                "description": "A recipient column ('display_name', 'phone', 'email') or the exact name of a key in the person's attached data (extra_data). Those three names always read the column — a key spelled the same is unreachable; any other string reads the attached data, matched verbatim as a top-level key. A missing or empty value falls to `fallback`, and with no fallback the person parks (needs_data)."
                              },
                              "fallback": {
                                "type": "string"
                              },
                              "type": {
                                "description": "Optional. Applies to attached-data sources only — ignored on the three columns. How to read the value: string, number, boolean, date, string[] or number[] — the same vocabulary as People-table columns. Absent: text and numbers pass through, anything else counts as missing. Declared: text is parsed where it is unambiguous (\"250\" as a number or a string, \"true\" as a boolean, an ISO-shaped date such as \"2026-03-12\" — other date spellings and epoch numbers are missing), a date renders as a plain day in the person's timezone, a list needs an actual list in the data and joins with commas, dropping items it cannot read, and a value that cannot be read as the declared type counts as missing.",
                                "type": "string",
                                "enum": [
                                  "string",
                                  "number",
                                  "boolean",
                                  "date",
                                  "string[]",
                                  "number[]"
                                ]
                              }
                            },
                            "required": [
                              "source"
                            ]
                          },
                          "description": "Body bindings keyed by positional index (\"1\", \"2\") or exact parameter name (\"first_name\")."
                        },
                        "buttons": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string",
                            "pattern": "^[0-9]$"
                          },
                          "additionalProperties": {
                            "type": "object",
                            "properties": {
                              "source": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200,
                                "description": "A recipient column ('display_name', 'phone', 'email') or the exact name of a key in the person's attached data (extra_data). Those three names always read the column — a key spelled the same is unreachable; any other string reads the attached data, matched verbatim as a top-level key. A missing or empty value falls to `fallback`, and with no fallback the person parks (needs_data)."
                              },
                              "fallback": {
                                "type": "string"
                              },
                              "type": {
                                "description": "Optional. Applies to attached-data sources only — ignored on the three columns. How to read the value: string, number, boolean, date, string[] or number[] — the same vocabulary as People-table columns. Absent: text and numbers pass through, anything else counts as missing. Declared: text is parsed where it is unambiguous (\"250\" as a number or a string, \"true\" as a boolean, an ISO-shaped date such as \"2026-03-12\" — other date spellings and epoch numbers are missing), a date renders as a plain day in the person's timezone, a list needs an actual list in the data and joins with commas, dropping items it cannot read, and a value that cannot be read as the declared type counts as missing.",
                                "type": "string",
                                "enum": [
                                  "string",
                                  "number",
                                  "boolean",
                                  "date",
                                  "string[]",
                                  "number[]"
                                ]
                              }
                            },
                            "required": [
                              "source"
                            ]
                          }
                        }
                      },
                      "required": [
                        "type",
                        "template_name",
                        "template_language",
                        "variables"
                      ]
                    },
                    "delay_minutes": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 129600
                    }
                  },
                  "required": [
                    "channel",
                    "content",
                    "delay_minutes"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "channel": {
                      "type": "string",
                      "const": "voice"
                    },
                    "content": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "voice_call"
                        },
                        "extra_instructions": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 8000
                        },
                        "variables": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 64
                          },
                          "additionalProperties": {
                            "type": "object",
                            "properties": {
                              "source": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200,
                                "description": "A recipient column ('display_name', 'phone', 'email') or the exact name of a key in the person's attached data (extra_data). Those three names always read the column — a key spelled the same is unreachable; any other string reads the attached data, matched verbatim as a top-level key. A missing or empty value falls to `fallback`, and with no fallback the person parks (needs_data)."
                              },
                              "fallback": {
                                "type": "string"
                              },
                              "type": {
                                "description": "Optional. Applies to attached-data sources only — ignored on the three columns. How to read the value: string, number, boolean, date, string[] or number[] — the same vocabulary as People-table columns. Absent: text and numbers pass through, anything else counts as missing. Declared: text is parsed where it is unambiguous (\"250\" as a number or a string, \"true\" as a boolean, an ISO-shaped date such as \"2026-03-12\" — other date spellings and epoch numbers are missing), a date renders as a plain day in the person's timezone, a list needs an actual list in the data and joins with commas, dropping items it cannot read, and a value that cannot be read as the declared type counts as missing.",
                                "type": "string",
                                "enum": [
                                  "string",
                                  "number",
                                  "boolean",
                                  "date",
                                  "string[]",
                                  "number[]"
                                ]
                              }
                            },
                            "required": [
                              "source"
                            ]
                          }
                        },
                        "handled_by": {
                          "description": "Who takes the call: \"ai\" (default) — the sequence's AI phone agent; \"human\" — a team of agents, dialed for them through the org's own SIP trunk. Omitted = \"ai\", except on an update of a human step, which must say \"ai\" to switch it.",
                          "type": "string",
                          "enum": [
                            "ai",
                            "human"
                          ]
                        },
                        "team_id": {
                          "description": "Human steps: the team whose free agents take the calls. Required when handled_by is \"human\".",
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "trunk_id": {
                          "description": "Human steps: the org's own SIP trunk the calls go out through (see list voice trunks). Required when handled_by is \"human\".",
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                        },
                        "caller_id": {
                          "description": "Human steps: the number shown to the person, in E.164 (+ and digits), one of the workspace's verified numbers. Omitted = the trunk's default.",
                          "type": "string",
                          "pattern": "^\\+[1-9]\\d{6,14}$"
                        },
                        "numbers_per_free_agent": {
                          "description": "Human steps: how many numbers ring at once for each free agent (1–5, default 1). Above 1, a person who picks up while every agent is busy is missed and gets the next step.",
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 5
                        }
                      },
                      "required": [
                        "type"
                      ]
                    },
                    "delay_minutes": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 129600
                    }
                  },
                  "required": [
                    "channel",
                    "content",
                    "delay_minutes"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "channel": {
                      "type": "string",
                      "const": "email"
                    },
                    "content": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "email"
                        },
                        "subject": {
                          "type": "string",
                          "minLength": 1
                        },
                        "html": {
                          "type": "string",
                          "minLength": 1
                        },
                        "text": {
                          "type": "string",
                          "minLength": 1
                        },
                        "variables": {
                          "default": {},
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "object",
                            "properties": {
                              "source": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200,
                                "description": "A recipient column ('display_name', 'phone', 'email') or the exact name of a key in the person's attached data (extra_data). Those three names always read the column — a key spelled the same is unreachable; any other string reads the attached data, matched verbatim as a top-level key. A missing or empty value falls to `fallback`, and with no fallback the person parks (needs_data)."
                              },
                              "fallback": {
                                "type": "string"
                              },
                              "type": {
                                "description": "Optional. Applies to attached-data sources only — ignored on the three columns. How to read the value: string, number, boolean, date, string[] or number[] — the same vocabulary as People-table columns. Absent: text and numbers pass through, anything else counts as missing. Declared: text is parsed where it is unambiguous (\"250\" as a number or a string, \"true\" as a boolean, an ISO-shaped date such as \"2026-03-12\" — other date spellings and epoch numbers are missing), a date renders as a plain day in the person's timezone, a list needs an actual list in the data and joins with commas, dropping items it cannot read, and a value that cannot be read as the declared type counts as missing.",
                                "type": "string",
                                "enum": [
                                  "string",
                                  "number",
                                  "boolean",
                                  "date",
                                  "string[]",
                                  "number[]"
                                ]
                              }
                            },
                            "required": [
                              "source"
                            ]
                          }
                        }
                      },
                      "required": [
                        "type",
                        "subject",
                        "html",
                        "text"
                      ]
                    },
                    "delay_minutes": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 129600
                    }
                  },
                  "required": [
                    "channel",
                    "content",
                    "delay_minutes"
                  ]
                }
              ]
            },
            "description": "The full step list, replacing whatever is stored. Same validation as create: step 0 must have delay_minutes 0."
          }
        },
        "required": [
          "steps"
        ]
      },
      "EditSequenceStepsDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/EditSequenceStepsDtoInput",
        "type": "object",
        "properties": {
          "edits": {
            "minItems": 1,
            "maxItems": 50,
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "op": {
                      "type": "string",
                      "const": "update"
                    },
                    "step_index": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "content": {
                      "description": "New content for the step. Must keep the step on its current channel.",
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "whatsapp_template"
                            },
                            "template_name": {
                              "type": "string",
                              "minLength": 1
                            },
                            "template_language": {
                              "type": "string",
                              "minLength": 1
                            },
                            "variables": {
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {
                                "type": "object",
                                "properties": {
                                  "source": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 200,
                                    "description": "A recipient column ('display_name', 'phone', 'email') or the exact name of a key in the person's attached data (extra_data). Those three names always read the column — a key spelled the same is unreachable; any other string reads the attached data, matched verbatim as a top-level key. A missing or empty value falls to `fallback`, and with no fallback the person parks (needs_data)."
                                  },
                                  "fallback": {
                                    "type": "string"
                                  },
                                  "type": {
                                    "description": "Optional. Applies to attached-data sources only — ignored on the three columns. How to read the value: string, number, boolean, date, string[] or number[] — the same vocabulary as People-table columns. Absent: text and numbers pass through, anything else counts as missing. Declared: text is parsed where it is unambiguous (\"250\" as a number or a string, \"true\" as a boolean, an ISO-shaped date such as \"2026-03-12\" — other date spellings and epoch numbers are missing), a date renders as a plain day in the person's timezone, a list needs an actual list in the data and joins with commas, dropping items it cannot read, and a value that cannot be read as the declared type counts as missing.",
                                    "type": "string",
                                    "enum": [
                                      "string",
                                      "number",
                                      "boolean",
                                      "date",
                                      "string[]",
                                      "number[]"
                                    ]
                                  }
                                },
                                "required": [
                                  "source"
                                ]
                              },
                              "description": "Body bindings keyed by positional index (\"1\", \"2\") or exact parameter name (\"first_name\")."
                            },
                            "buttons": {
                              "type": "object",
                              "propertyNames": {
                                "type": "string",
                                "pattern": "^[0-9]$"
                              },
                              "additionalProperties": {
                                "type": "object",
                                "properties": {
                                  "source": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 200,
                                    "description": "A recipient column ('display_name', 'phone', 'email') or the exact name of a key in the person's attached data (extra_data). Those three names always read the column — a key spelled the same is unreachable; any other string reads the attached data, matched verbatim as a top-level key. A missing or empty value falls to `fallback`, and with no fallback the person parks (needs_data)."
                                  },
                                  "fallback": {
                                    "type": "string"
                                  },
                                  "type": {
                                    "description": "Optional. Applies to attached-data sources only — ignored on the three columns. How to read the value: string, number, boolean, date, string[] or number[] — the same vocabulary as People-table columns. Absent: text and numbers pass through, anything else counts as missing. Declared: text is parsed where it is unambiguous (\"250\" as a number or a string, \"true\" as a boolean, an ISO-shaped date such as \"2026-03-12\" — other date spellings and epoch numbers are missing), a date renders as a plain day in the person's timezone, a list needs an actual list in the data and joins with commas, dropping items it cannot read, and a value that cannot be read as the declared type counts as missing.",
                                    "type": "string",
                                    "enum": [
                                      "string",
                                      "number",
                                      "boolean",
                                      "date",
                                      "string[]",
                                      "number[]"
                                    ]
                                  }
                                },
                                "required": [
                                  "source"
                                ]
                              }
                            }
                          },
                          "required": [
                            "type",
                            "template_name",
                            "template_language",
                            "variables"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "voice_call"
                            },
                            "extra_instructions": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 8000
                            },
                            "variables": {
                              "type": "object",
                              "propertyNames": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 64
                              },
                              "additionalProperties": {
                                "type": "object",
                                "properties": {
                                  "source": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 200,
                                    "description": "A recipient column ('display_name', 'phone', 'email') or the exact name of a key in the person's attached data (extra_data). Those three names always read the column — a key spelled the same is unreachable; any other string reads the attached data, matched verbatim as a top-level key. A missing or empty value falls to `fallback`, and with no fallback the person parks (needs_data)."
                                  },
                                  "fallback": {
                                    "type": "string"
                                  },
                                  "type": {
                                    "description": "Optional. Applies to attached-data sources only — ignored on the three columns. How to read the value: string, number, boolean, date, string[] or number[] — the same vocabulary as People-table columns. Absent: text and numbers pass through, anything else counts as missing. Declared: text is parsed where it is unambiguous (\"250\" as a number or a string, \"true\" as a boolean, an ISO-shaped date such as \"2026-03-12\" — other date spellings and epoch numbers are missing), a date renders as a plain day in the person's timezone, a list needs an actual list in the data and joins with commas, dropping items it cannot read, and a value that cannot be read as the declared type counts as missing.",
                                    "type": "string",
                                    "enum": [
                                      "string",
                                      "number",
                                      "boolean",
                                      "date",
                                      "string[]",
                                      "number[]"
                                    ]
                                  }
                                },
                                "required": [
                                  "source"
                                ]
                              }
                            },
                            "handled_by": {
                              "description": "Who takes the call: \"ai\" (default) — the sequence's AI phone agent; \"human\" — a team of agents, dialed for them through the org's own SIP trunk. Omitted = \"ai\", except on an update of a human step, which must say \"ai\" to switch it.",
                              "type": "string",
                              "enum": [
                                "ai",
                                "human"
                              ]
                            },
                            "team_id": {
                              "description": "Human steps: the team whose free agents take the calls. Required when handled_by is \"human\".",
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64
                            },
                            "trunk_id": {
                              "description": "Human steps: the org's own SIP trunk the calls go out through (see list voice trunks). Required when handled_by is \"human\".",
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                            },
                            "caller_id": {
                              "description": "Human steps: the number shown to the person, in E.164 (+ and digits), one of the workspace's verified numbers. Omitted = the trunk's default.",
                              "type": "string",
                              "pattern": "^\\+[1-9]\\d{6,14}$"
                            },
                            "numbers_per_free_agent": {
                              "description": "Human steps: how many numbers ring at once for each free agent (1–5, default 1). Above 1, a person who picks up while every agent is busy is missed and gets the next step.",
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 5
                            }
                          },
                          "required": [
                            "type"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "email"
                            },
                            "subject": {
                              "type": "string",
                              "minLength": 1
                            },
                            "html": {
                              "type": "string",
                              "minLength": 1
                            },
                            "text": {
                              "type": "string",
                              "minLength": 1
                            },
                            "variables": {
                              "default": {},
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {
                                "type": "object",
                                "properties": {
                                  "source": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 200,
                                    "description": "A recipient column ('display_name', 'phone', 'email') or the exact name of a key in the person's attached data (extra_data). Those three names always read the column — a key spelled the same is unreachable; any other string reads the attached data, matched verbatim as a top-level key. A missing or empty value falls to `fallback`, and with no fallback the person parks (needs_data)."
                                  },
                                  "fallback": {
                                    "type": "string"
                                  },
                                  "type": {
                                    "description": "Optional. Applies to attached-data sources only — ignored on the three columns. How to read the value: string, number, boolean, date, string[] or number[] — the same vocabulary as People-table columns. Absent: text and numbers pass through, anything else counts as missing. Declared: text is parsed where it is unambiguous (\"250\" as a number or a string, \"true\" as a boolean, an ISO-shaped date such as \"2026-03-12\" — other date spellings and epoch numbers are missing), a date renders as a plain day in the person's timezone, a list needs an actual list in the data and joins with commas, dropping items it cannot read, and a value that cannot be read as the declared type counts as missing.",
                                    "type": "string",
                                    "enum": [
                                      "string",
                                      "number",
                                      "boolean",
                                      "date",
                                      "string[]",
                                      "number[]"
                                    ]
                                  }
                                },
                                "required": [
                                  "source"
                                ]
                              }
                            }
                          },
                          "required": [
                            "type",
                            "subject",
                            "html"
                          ]
                        }
                      ]
                    },
                    "delay_minutes": {
                      "description": "New wait before this step, in minutes. Step 0 must stay 0.",
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 129600
                    }
                  },
                  "required": [
                    "op",
                    "step_index"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "op": {
                      "type": "string",
                      "const": "append"
                    },
                    "steps": {
                      "minItems": 1,
                      "maxItems": 20,
                      "type": "array",
                      "items": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "channel": {
                                "type": "string",
                                "const": "whatsapp"
                              },
                              "content": {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "whatsapp_template"
                                  },
                                  "template_name": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "template_language": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "variables": {
                                    "type": "object",
                                    "propertyNames": {
                                      "type": "string"
                                    },
                                    "additionalProperties": {
                                      "type": "object",
                                      "properties": {
                                        "source": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 200,
                                          "description": "A recipient column ('display_name', 'phone', 'email') or the exact name of a key in the person's attached data (extra_data). Those three names always read the column — a key spelled the same is unreachable; any other string reads the attached data, matched verbatim as a top-level key. A missing or empty value falls to `fallback`, and with no fallback the person parks (needs_data)."
                                        },
                                        "fallback": {
                                          "type": "string"
                                        },
                                        "type": {
                                          "description": "Optional. Applies to attached-data sources only — ignored on the three columns. How to read the value: string, number, boolean, date, string[] or number[] — the same vocabulary as People-table columns. Absent: text and numbers pass through, anything else counts as missing. Declared: text is parsed where it is unambiguous (\"250\" as a number or a string, \"true\" as a boolean, an ISO-shaped date such as \"2026-03-12\" — other date spellings and epoch numbers are missing), a date renders as a plain day in the person's timezone, a list needs an actual list in the data and joins with commas, dropping items it cannot read, and a value that cannot be read as the declared type counts as missing.",
                                          "type": "string",
                                          "enum": [
                                            "string",
                                            "number",
                                            "boolean",
                                            "date",
                                            "string[]",
                                            "number[]"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "source"
                                      ]
                                    },
                                    "description": "Body bindings keyed by positional index (\"1\", \"2\") or exact parameter name (\"first_name\")."
                                  },
                                  "buttons": {
                                    "type": "object",
                                    "propertyNames": {
                                      "type": "string",
                                      "pattern": "^[0-9]$"
                                    },
                                    "additionalProperties": {
                                      "type": "object",
                                      "properties": {
                                        "source": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 200,
                                          "description": "A recipient column ('display_name', 'phone', 'email') or the exact name of a key in the person's attached data (extra_data). Those three names always read the column — a key spelled the same is unreachable; any other string reads the attached data, matched verbatim as a top-level key. A missing or empty value falls to `fallback`, and with no fallback the person parks (needs_data)."
                                        },
                                        "fallback": {
                                          "type": "string"
                                        },
                                        "type": {
                                          "description": "Optional. Applies to attached-data sources only — ignored on the three columns. How to read the value: string, number, boolean, date, string[] or number[] — the same vocabulary as People-table columns. Absent: text and numbers pass through, anything else counts as missing. Declared: text is parsed where it is unambiguous (\"250\" as a number or a string, \"true\" as a boolean, an ISO-shaped date such as \"2026-03-12\" — other date spellings and epoch numbers are missing), a date renders as a plain day in the person's timezone, a list needs an actual list in the data and joins with commas, dropping items it cannot read, and a value that cannot be read as the declared type counts as missing.",
                                          "type": "string",
                                          "enum": [
                                            "string",
                                            "number",
                                            "boolean",
                                            "date",
                                            "string[]",
                                            "number[]"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "source"
                                      ]
                                    }
                                  }
                                },
                                "required": [
                                  "type",
                                  "template_name",
                                  "template_language",
                                  "variables"
                                ]
                              },
                              "delay_minutes": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 129600
                              }
                            },
                            "required": [
                              "channel",
                              "content",
                              "delay_minutes"
                            ]
                          },
                          {
                            "type": "object",
                            "properties": {
                              "channel": {
                                "type": "string",
                                "const": "voice"
                              },
                              "content": {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "voice_call"
                                  },
                                  "extra_instructions": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 8000
                                  },
                                  "variables": {
                                    "type": "object",
                                    "propertyNames": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 64
                                    },
                                    "additionalProperties": {
                                      "type": "object",
                                      "properties": {
                                        "source": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 200,
                                          "description": "A recipient column ('display_name', 'phone', 'email') or the exact name of a key in the person's attached data (extra_data). Those three names always read the column — a key spelled the same is unreachable; any other string reads the attached data, matched verbatim as a top-level key. A missing or empty value falls to `fallback`, and with no fallback the person parks (needs_data)."
                                        },
                                        "fallback": {
                                          "type": "string"
                                        },
                                        "type": {
                                          "description": "Optional. Applies to attached-data sources only — ignored on the three columns. How to read the value: string, number, boolean, date, string[] or number[] — the same vocabulary as People-table columns. Absent: text and numbers pass through, anything else counts as missing. Declared: text is parsed where it is unambiguous (\"250\" as a number or a string, \"true\" as a boolean, an ISO-shaped date such as \"2026-03-12\" — other date spellings and epoch numbers are missing), a date renders as a plain day in the person's timezone, a list needs an actual list in the data and joins with commas, dropping items it cannot read, and a value that cannot be read as the declared type counts as missing.",
                                          "type": "string",
                                          "enum": [
                                            "string",
                                            "number",
                                            "boolean",
                                            "date",
                                            "string[]",
                                            "number[]"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "source"
                                      ]
                                    }
                                  },
                                  "handled_by": {
                                    "description": "Who takes the call: \"ai\" (default) — the sequence's AI phone agent; \"human\" — a team of agents, dialed for them through the org's own SIP trunk. Omitted = \"ai\", except on an update of a human step, which must say \"ai\" to switch it.",
                                    "type": "string",
                                    "enum": [
                                      "ai",
                                      "human"
                                    ]
                                  },
                                  "team_id": {
                                    "description": "Human steps: the team whose free agents take the calls. Required when handled_by is \"human\".",
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 64
                                  },
                                  "trunk_id": {
                                    "description": "Human steps: the org's own SIP trunk the calls go out through (see list voice trunks). Required when handled_by is \"human\".",
                                    "type": "string",
                                    "format": "uuid",
                                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                                  },
                                  "caller_id": {
                                    "description": "Human steps: the number shown to the person, in E.164 (+ and digits), one of the workspace's verified numbers. Omitted = the trunk's default.",
                                    "type": "string",
                                    "pattern": "^\\+[1-9]\\d{6,14}$"
                                  },
                                  "numbers_per_free_agent": {
                                    "description": "Human steps: how many numbers ring at once for each free agent (1–5, default 1). Above 1, a person who picks up while every agent is busy is missed and gets the next step.",
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 5
                                  }
                                },
                                "required": [
                                  "type"
                                ]
                              },
                              "delay_minutes": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 129600
                              }
                            },
                            "required": [
                              "channel",
                              "content",
                              "delay_minutes"
                            ]
                          },
                          {
                            "type": "object",
                            "properties": {
                              "channel": {
                                "type": "string",
                                "const": "email"
                              },
                              "content": {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "email"
                                  },
                                  "subject": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "html": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "text": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "variables": {
                                    "default": {},
                                    "type": "object",
                                    "propertyNames": {
                                      "type": "string"
                                    },
                                    "additionalProperties": {
                                      "type": "object",
                                      "properties": {
                                        "source": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 200,
                                          "description": "A recipient column ('display_name', 'phone', 'email') or the exact name of a key in the person's attached data (extra_data). Those three names always read the column — a key spelled the same is unreachable; any other string reads the attached data, matched verbatim as a top-level key. A missing or empty value falls to `fallback`, and with no fallback the person parks (needs_data)."
                                        },
                                        "fallback": {
                                          "type": "string"
                                        },
                                        "type": {
                                          "description": "Optional. Applies to attached-data sources only — ignored on the three columns. How to read the value: string, number, boolean, date, string[] or number[] — the same vocabulary as People-table columns. Absent: text and numbers pass through, anything else counts as missing. Declared: text is parsed where it is unambiguous (\"250\" as a number or a string, \"true\" as a boolean, an ISO-shaped date such as \"2026-03-12\" — other date spellings and epoch numbers are missing), a date renders as a plain day in the person's timezone, a list needs an actual list in the data and joins with commas, dropping items it cannot read, and a value that cannot be read as the declared type counts as missing.",
                                          "type": "string",
                                          "enum": [
                                            "string",
                                            "number",
                                            "boolean",
                                            "date",
                                            "string[]",
                                            "number[]"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "source"
                                      ]
                                    }
                                  }
                                },
                                "required": [
                                  "type",
                                  "subject",
                                  "html",
                                  "text"
                                ]
                              },
                              "delay_minutes": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 129600
                              }
                            },
                            "required": [
                              "channel",
                              "content",
                              "delay_minutes"
                            ]
                          }
                        ]
                      },
                      "description": "Steps added at the END of the journey, in order."
                    }
                  },
                  "required": [
                    "op",
                    "steps"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "op": {
                      "type": "string",
                      "const": "remove"
                    },
                    "step_index": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "op",
                    "step_index"
                  ]
                }
              ]
            }
          }
        },
        "required": [
          "edits"
        ]
      },
      "UpdateSequenceDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdateSequenceDtoInput",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "brief": {
            "type": "string",
            "maxLength": 10000
          },
          "reply_instructions": {
            "type": "string"
          },
          "criteria": {
            "type": "object",
            "properties": {
              "must": {
                "maxItems": 20,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "label": {
                      "type": "string",
                      "minLength": 2,
                      "maxLength": 60,
                      "description": "A few words naming this criterion, shown in the dashboard — \"Recent invoicing complaint\", \"Business account\". Not a sentence."
                    },
                    "text": {
                      "type": "string",
                      "minLength": 3,
                      "maxLength": 500,
                      "description": "The full instruction the judge reads. Name the boundary explicitly — what counts and what does not. Never shown in the table."
                    }
                  },
                  "required": [
                    "label",
                    "text"
                  ]
                }
              },
              "nice": {
                "maxItems": 20,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "label": {
                      "type": "string",
                      "minLength": 2,
                      "maxLength": 60,
                      "description": "A few words naming this criterion, shown in the dashboard — \"Recent invoicing complaint\", \"Business account\". Not a sentence."
                    },
                    "text": {
                      "type": "string",
                      "minLength": 3,
                      "maxLength": 500,
                      "description": "The full instruction the judge reads. Name the boundary explicitly — what counts and what does not. Never shown in the table."
                    },
                    "grade": {
                      "type": "string",
                      "enum": [
                        "high",
                        "medium",
                        "low"
                      ]
                    }
                  },
                  "required": [
                    "label",
                    "text",
                    "grade"
                  ]
                }
              }
            },
            "required": [
              "must",
              "nice"
            ]
          },
          "settings": {
            "type": "object",
            "properties": {
              "block_active_elsewhere": {
                "type": "boolean"
              },
              "block_contacted_before": {
                "type": "boolean"
              },
              "respect_office_hours": {
                "type": "boolean"
              },
              "office_hours_id": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "fit_cutoff": {
                "type": "integer",
                "minimum": 75,
                "maximum": 100
              }
            }
          }
        }
      },
      "UpdateSequenceStepDelayDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdateSequenceStepDelayDtoInput",
        "type": "object",
        "properties": {
          "delay_minutes": {
            "type": "integer",
            "minimum": 0,
            "maximum": 129600,
            "description": "Minutes to wait after the PREVIOUS message actually sent. Step 0 must be 0 — the first message is armed by launch or enrolment, never by a delay."
          }
        },
        "required": [
          "delay_minutes"
        ]
      },
      "SetSequenceSendersDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SetSequenceSendersDtoInput",
        "type": "object",
        "properties": {
          "channel": {
            "type": "string",
            "enum": [
              "whatsapp",
              "voice",
              "email"
            ]
          },
          "sender_ids": {
            "maxItems": 100,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          }
        },
        "required": [
          "channel",
          "sender_ids"
        ]
      },
      "SuggestEmailFleetDomainsDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SuggestEmailFleetDomainsDtoInput",
        "type": "object",
        "properties": {
          "keyword": {
            "type": "string",
            "minLength": 2,
            "maxLength": 60
          },
          "tlds": {
            "minItems": 1,
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "com",
                "org"
              ]
            }
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          }
        },
        "required": [
          "keyword"
        ]
      },
      "CreateSkillDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CreateSkillDtoInput",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "name"
        ]
      },
      "UpdateSkillDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdateSkillDtoInput",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "UpdateUserSkillsDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdateUserSkillsDtoInput",
        "type": "object",
        "properties": {
          "skill_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            }
          }
        },
        "required": [
          "skill_ids"
        ]
      },
      "UpdateCategoryInLanguageDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdateCategoryInLanguageDtoInput",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1
          },
          "description": {
            "description": "Short blurb shown under the topic name. Omitting it CLEARS the stored description.",
            "type": "string"
          },
          "icon": {
            "description": "Lucide icon name in kebab-case (e.g. 'folder', 'credit-card' — see lucide.dev/icons). null clears the icon; omitted leaves it untouched.",
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "language_code": {
            "description": "The language whose name and description are written. Omitted = the primary language, which the other languages are re-translated from; another language edits that translation only.",
            "type": "string"
          }
        },
        "required": [
          "name"
        ]
      },
      "EditArticleDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/EditArticleDtoInput",
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1
          },
          "content_html": {
            "description": "Article body as an HTML fragment. Embed a video with `<div data-embed=\"youtube\" data-embed-id=\"VIDEO_ID\"></div>`, where `data-embed` is `youtube`, `vimeo`, `loom` or `wistia`; iframes are removed.",
            "type": "string"
          },
          "meta_title": {
            "type": "string"
          },
          "meta_description": {
            "type": "string"
          },
          "language_code": {
            "type": "string"
          }
        },
        "required": [
          "title"
        ],
        "additionalProperties": false
      },
      "CreateGlossaryTermDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CreateGlossaryTermDtoInput",
        "type": "object",
        "properties": {
          "term": {
            "type": "string",
            "minLength": 1
          },
          "definition": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": [
          "term",
          "definition"
        ]
      },
      "UpdateGlossaryTermDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdateGlossaryTermDtoInput",
        "type": "object",
        "properties": {
          "term": {
            "type": "string",
            "minLength": 1
          },
          "definition": {
            "type": "string",
            "minLength": 1
          }
        }
      },
      "HelpCenterMoveArticleDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/HelpCenterMoveArticleDtoInput",
        "type": "object",
        "properties": {
          "article_entity_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "language_code": {
            "type": "string",
            "minLength": 2
          },
          "category_entity_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "position": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "scope": {
            "type": "string",
            "enum": [
              "all_languages",
              "this_language"
            ],
            "description": "all_languages: the move applies to every language, appended at the end of the destination in the others. this_language: only the named language. Omitted: the help center setting decides."
          }
        },
        "required": [
          "article_entity_id",
          "language_code",
          "category_entity_id",
          "position"
        ]
      },
      "HelpCenterMoveTopicDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/HelpCenterMoveTopicDtoInput",
        "type": "object",
        "properties": {
          "category_entity_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "language_code": {
            "type": "string",
            "minLength": 2
          },
          "parent_category_entity_id": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              {
                "type": "null"
              }
            ]
          },
          "position": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "scope": {
            "type": "string",
            "enum": [
              "all_languages",
              "this_language"
            ],
            "description": "all_languages: the move applies to every language, appended at the end of the destination in the others. this_language: only the named language. Omitted: the help center setting decides."
          }
        },
        "required": [
          "category_entity_id",
          "language_code",
          "parent_category_entity_id",
          "position"
        ]
      },
      "HelpCenterReorderDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/HelpCenterReorderDtoInput",
        "type": "object",
        "properties": {
          "language_code": {
            "type": "string",
            "minLength": 2
          },
          "parent_category_entity_id": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              {
                "type": "null"
              }
            ]
          },
          "ordered_ids": {
            "minItems": 1,
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            }
          }
        },
        "required": [
          "language_code",
          "parent_category_entity_id",
          "ordered_ids"
        ]
      },
      "GetVocQueryDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/GetVocQueryDtoInput",
        "type": "object",
        "properties": {
          "category": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Filter by category name"
          },
          "status": {
            "anyOf": [
              {
                "default": "all",
                "type": "string",
                "enum": [
                  "all",
                  "unresolved",
                  "resolved",
                  "archived"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "sentiment": {
            "anyOf": [
              {
                "description": "Filter by sentiment",
                "type": "string",
                "enum": [
                  "angry",
                  "happy",
                  "neutral"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "sortBy": {
            "anyOf": [
              {
                "default": "occurrence_count",
                "type": "string",
                "enum": [
                  "occurrence_count",
                  "last_seen_at",
                  "first_seen_at",
                  "created_at"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "sortOrder": {
            "anyOf": [
              {
                "default": "desc",
                "type": "string",
                "enum": [
                  "asc",
                  "desc"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "minSessions": {
            "anyOf": [
              {
                "description": "Minimum occurrence count",
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "search": {
            "description": "Search in insight content",
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "teamId": {
            "description": "Filter by specific team ID or none for unassigned insights",
            "anyOf": [
              {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  {
                    "type": "string",
                    "const": "not_assigned"
                  },
                  {
                    "type": "null",
                    "const": null
                  }
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "insightNumber": {
            "anyOf": [
              {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ],
            "description": "Filter by insight number"
          },
          "sessionLanguage": {
            "description": "Filter by language",
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "az",
                  "el",
                  "de",
                  "fr",
                  "it",
                  "es",
                  "pt",
                  "nl",
                  "da",
                  "sv",
                  "no",
                  "fi",
                  "et",
                  "is",
                  "pl",
                  "cs",
                  "sk",
                  "hu",
                  "ro",
                  "bg",
                  "hr",
                  "sr",
                  "uk",
                  "ru",
                  "tr",
                  "en",
                  "zh",
                  "ja",
                  "ko",
                  "hi",
                  "bn",
                  "id",
                  "ms",
                  "th",
                  "vi",
                  "tl",
                  "ar",
                  "he",
                  "fa",
                  "ur",
                  "af",
                  "sw",
                  "ku",
                  "ckb",
                  "kmr"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "ticketSentiment": {
            "anyOf": [
              {
                "description": "Filter by sentiment",
                "type": "string",
                "enum": [
                  "angry",
                  "happy",
                  "neutral"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "channel": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SessionChannel"
              },
              {
                "type": "null"
              }
            ],
            "description": "Filter by session channel"
          },
          "sessionFromDate": {
            "anyOf": [
              {
                "description": "Filter sessions created from this date (ISO 8601)",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "sessionToDate": {
            "anyOf": [
              {
                "description": "Filter sessions created to this date (ISO 8601)",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "sessionStatus": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "closed_resolved",
                  "closed_unresolved",
                  "open"
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "Filter by session status"
          },
          "sessionContactId": {
            "anyOf": [
              {
                "description": "Filter by session contact ID",
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              {
                "type": "null"
              }
            ]
          },
          "ticketCustomData": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {
                    "type": "string"
                  }
                }
              },
              {
                "type": "null"
              }
            ],
            "description": "A list of objects with key-value pairs to filter by. Relationship is OR between objects, and AND between the values in each object"
          },
          "contactCustomData": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {
                    "type": "string"
                  }
                }
              },
              {
                "type": "null"
              }
            ],
            "description": "Filter by contact custom data key-value pairs"
          },
          "page": {
            "default": 1,
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          }
        }
      },
      "ArchiveInsightDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ArchiveInsightDtoInput",
        "type": "object",
        "properties": {
          "policy": {
            "default": "until_escalating",
            "description": "When the insight should resurface after archiving",
            "type": "string",
            "enum": [
              "forever",
              "until_count",
              "until_escalating"
            ]
          },
          "reason": {
            "description": "Reason for archiving",
            "type": "string"
          }
        }
      },
      "WebsiteCrawlAuthDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/WebsiteCrawlAuthDtoInput",
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "basic"
              },
              "username": {
                "type": "string",
                "minLength": 1
              },
              "password": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": [
              "type",
              "username",
              "password"
            ]
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "bearer"
              },
              "token": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": [
              "type",
              "token"
            ]
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "cookie"
              },
              "value": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": [
              "type",
              "value"
            ]
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "headers"
              },
              "headers": {
                "type": "object",
                "propertyNames": {
                  "type": "string",
                  "minLength": 1
                },
                "additionalProperties": {
                  "type": "string",
                  "minLength": 1
                }
              }
            },
            "required": [
              "type",
              "headers"
            ]
          }
        ]
      },
      "CreateWebsiteDatasourceDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CreateWebsiteDatasourceDtoInput",
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "display_name": {
            "type": "string"
          },
          "page_limit": {
            "default": 100,
            "anyOf": [
              {
                "type": "integer",
                "minimum": 1,
                "maximum": 5000
              },
              {
                "type": "null"
              }
            ]
          },
          "exclude_paths": {
            "default": [],
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "include_paths": {
            "default": [],
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "crawl_interval_hours": {
            "default": 168,
            "anyOf": [
              {
                "type": "integer",
                "minimum": 168,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "auto_start_crawl": {
            "default": true,
            "type": "boolean"
          },
          "restricted_to_channels": {
            "default": [],
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SessionChannel"
            }
          },
          "auth": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/WebsiteCrawlAuthDto"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "url"
        ]
      },
      "UpdateWebsiteDatasourceDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdateWebsiteDatasourceDtoInput",
        "type": "object",
        "properties": {
          "display_name": {
            "type": "string"
          },
          "page_limit": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 1,
                "maximum": 5000
              },
              {
                "type": "null"
              }
            ]
          },
          "exclude_paths": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "include_paths": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "crawl_interval_hours": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 168,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "paused"
            ]
          },
          "restricted_to_channels": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SessionChannel"
            }
          },
          "auth": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/WebsiteCrawlAuthDto"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "BulkPageActionDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/BulkPageActionDtoInput",
        "type": "object",
        "properties": {
          "page_ids": {
            "minItems": 1,
            "maxItems": 100,
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            }
          }
        },
        "required": [
          "page_ids"
        ]
      },
      "DeletePagesDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/DeletePagesDtoInput",
        "type": "object",
        "properties": {
          "page_ids": {
            "minItems": 1,
            "maxItems": 100,
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            }
          },
          "delete_kb_items": {
            "default": false,
            "type": "boolean"
          }
        },
        "required": [
          "page_ids"
        ]
      },
      "SyncPageByUrlDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SyncPageByUrlDtoInput",
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri",
            "description": "The URL to scrape and sync to the knowledge base"
          }
        },
        "required": [
          "url"
        ]
      },
      "PatchOnboardingDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/PatchOnboardingDtoInput",
        "type": "object",
        "properties": {
          "step": {
            "type": "string",
            "enum": [
              "training",
              "channels",
              "teammates"
            ]
          },
          "action": {
            "type": "string",
            "enum": [
              "complete",
              "skip",
              "dismiss"
            ]
          }
        },
        "required": [
          "action"
        ]
      },
      "CreateActionPublicDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CreateActionPublicDtoInput",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Action display name"
          },
          "description": {
            "description": "What this action does",
            "type": "string"
          },
          "api_endpoint": {
            "type": "string",
            "format": "uri",
            "description": "The full API endpoint URL to call"
          },
          "request_type": {
            "type": "string",
            "enum": [
              "GET",
              "POST",
              "PUT",
              "PATCH",
              "DELETE"
            ],
            "description": "HTTP method"
          },
          "operation_id": {
            "description": "Unique operation ID (auto-generated from name if omitted). 1-64 characters of [a-zA-Z0-9_-]: it is the tool name the AI agent calls, and phone agents reject anything else.",
            "type": "string",
            "pattern": "^[a-zA-Z0-9_-]{1,64}$"
          },
          "payload": {
            "type": "object",
            "properties": {
              "base_url": {
                "description": "Base URL for the API endpoint",
                "type": "string"
              },
              "path": {
                "description": "API path (e.g. \"/api/v1/bookings\")",
                "type": "string"
              },
              "method": {
                "description": "HTTP method (get, post, put, delete, patch)",
                "type": "string"
              },
              "operationId": {
                "description": "OpenAPI operation ID",
                "type": "string"
              },
              "summary": {
                "type": "string"
              },
              "description": {
                "type": "string"
              },
              "parameters": {
                "description": "Request parameters",
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string",
                      "description": "Parameter name"
                    },
                    "in": {
                      "type": "string",
                      "enum": [
                        "query",
                        "path",
                        "header",
                        "cookie"
                      ],
                      "description": "Where the parameter is sent"
                    },
                    "description": {
                      "type": "string"
                    },
                    "required": {
                      "type": "boolean"
                    },
                    "value": {
                      "description": "Fixed value for a query or path parameter. Omit or set null for a dynamic parameter.",
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "schema": {
                      "description": "JSON Schema for the parameter value",
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    }
                  },
                  "required": [
                    "name",
                    "in"
                  ]
                }
              },
              "requestBody": {
                "description": "Request body specification",
                "type": "object",
                "properties": {
                  "description": {
                    "type": "string"
                  },
                  "required": {
                    "type": "boolean"
                  },
                  "content": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "type": "object",
                      "properties": {
                        "schema": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {}
                        }
                      }
                    },
                    "description": "Content type to schema mapping (e.g. \"application/json\": { schema: {...} })"
                  }
                },
                "required": [
                  "content"
                ]
              },
              "responses": {
                "description": "Response specifications keyed by status code",
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              }
            },
            "additionalProperties": {},
            "description": "OpenAPI-style operation spec: parameters, requestBody, responses, etc."
          },
          "enabled_on_channel": {
            "description": "Channel restrictions (defaults to web only)",
            "type": "object",
            "properties": {
              "channels": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SessionChannel"
                },
                "description": "Channels where this action is available (e.g. [\"web\", \"email\", \"whatsapp\"])"
              }
            },
            "required": [
              "channels"
            ]
          },
          "pinned": {
            "description": "Whether to pin this action prominently",
            "type": "boolean"
          },
          "tags": {
            "description": "Tags for organizing actions",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "require_form_submission": {
            "description": "Require the user to submit a form before executing",
            "type": "boolean"
          },
          "restricted_to_segments": {
            "description": "Contact segment ids this action is restricted to. Empty/omit = available to all contacts. Segment ids come from list contact segments.",
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "name",
          "api_endpoint",
          "request_type",
          "payload"
        ]
      },
      "UpdateActionPublicDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdateActionPublicDtoInput",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Action display name"
          },
          "description": {
            "description": "What this action does",
            "type": "string"
          },
          "api_endpoint": {
            "type": "string",
            "format": "uri",
            "description": "The full API endpoint URL to call"
          },
          "request_type": {
            "type": "string",
            "enum": [
              "GET",
              "POST",
              "PUT",
              "PATCH",
              "DELETE"
            ],
            "description": "HTTP method"
          },
          "operation_id": {
            "description": "Unique operation ID (auto-generated from name if omitted). 1-64 characters of [a-zA-Z0-9_-]: it is the tool name the AI agent calls, and phone agents reject anything else.",
            "type": "string",
            "pattern": "^[a-zA-Z0-9_-]{1,64}$"
          },
          "payload": {
            "type": "object",
            "properties": {
              "base_url": {
                "description": "Base URL for the API endpoint",
                "type": "string"
              },
              "path": {
                "description": "API path (e.g. \"/api/v1/bookings\")",
                "type": "string"
              },
              "method": {
                "description": "HTTP method (get, post, put, delete, patch)",
                "type": "string"
              },
              "operationId": {
                "description": "OpenAPI operation ID",
                "type": "string"
              },
              "summary": {
                "type": "string"
              },
              "description": {
                "type": "string"
              },
              "parameters": {
                "description": "Request parameters",
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string",
                      "description": "Parameter name"
                    },
                    "in": {
                      "type": "string",
                      "enum": [
                        "query",
                        "path",
                        "header",
                        "cookie"
                      ],
                      "description": "Where the parameter is sent"
                    },
                    "description": {
                      "type": "string"
                    },
                    "required": {
                      "type": "boolean"
                    },
                    "value": {
                      "description": "Fixed value for a query or path parameter. Omit or set null for a dynamic parameter.",
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "schema": {
                      "description": "JSON Schema for the parameter value",
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    }
                  },
                  "required": [
                    "name",
                    "in"
                  ]
                }
              },
              "requestBody": {
                "description": "Request body specification",
                "type": "object",
                "properties": {
                  "description": {
                    "type": "string"
                  },
                  "required": {
                    "type": "boolean"
                  },
                  "content": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "type": "object",
                      "properties": {
                        "schema": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {}
                        }
                      }
                    },
                    "description": "Content type to schema mapping (e.g. \"application/json\": { schema: {...} })"
                  }
                },
                "required": [
                  "content"
                ]
              },
              "responses": {
                "description": "Response specifications keyed by status code",
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              }
            },
            "additionalProperties": {},
            "description": "OpenAPI-style operation spec: parameters, requestBody, responses, etc."
          },
          "enabled_on_channel": {
            "description": "Channel restrictions (defaults to web only)",
            "type": "object",
            "properties": {
              "channels": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SessionChannel"
                },
                "description": "Channels where this action is available (e.g. [\"web\", \"email\", \"whatsapp\"])"
              }
            },
            "required": [
              "channels"
            ]
          },
          "pinned": {
            "description": "Whether to pin this action prominently",
            "type": "boolean"
          },
          "tags": {
            "description": "Tags for organizing actions",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "require_form_submission": {
            "description": "Require the user to submit a form before executing",
            "type": "boolean"
          },
          "restricted_to_segments": {
            "description": "Contact segment ids this action is restricted to. Omit to leave unchanged; pass [] to clear. Segment ids come from list contact segments.",
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "InvokeActionDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/InvokeActionDtoInput",
        "type": "object",
        "properties": {
          "inputs": {
            "default": {},
            "description": "Inputs forwarded to the action’s HTTP request",
            "type": "object",
            "properties": {
              "queryParams": {
                "description": "Query string params",
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              },
              "pathParams": {
                "description": "Path template params",
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              },
              "body": {
                "description": "Request body (sent for non-GET methods)"
              }
            }
          },
          "context": {
            "type": "object",
            "properties": {
              "sessionId": {
                "description": "Optional conversation session. When given, the request is decorated with the same in-session context the AI agent attaches (org globals, contact identity, default headers, and — off web — per-contact backend auth).",
                "type": "string"
              }
            }
          }
        }
      },
      "UpdateAgentAvailabilityPublicDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdateAgentAvailabilityPublicDtoInput",
        "type": "object",
        "properties": {
          "is_available": {
            "description": "Whether the agent is available to take chats",
            "type": "boolean"
          },
          "custom_status": {
            "description": "Free-form status label",
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "max_concurrent_chats": {
            "description": "Per-agent chat capacity",
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "call_available": {
            "description": "Whether the agent is available for inbound phone calls",
            "type": "boolean"
          }
        }
      },
      "ApplyUserAvailabilityStatusDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ApplyUserAvailabilityStatusDtoInput",
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "special": {
                "type": "string",
                "enum": [
                  "online",
                  "offline"
                ],
                "description": "Hardcoded shortcut: 'online' = main availability on + available on every support team; 'offline' = main availability off + unavailable on every support team. Takes priority if status_id is also sent."
              }
            },
            "required": [
              "special"
            ]
          },
          {
            "type": "object",
            "properties": {
              "status_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                "description": "Id of a defined availability status (see listAvailabilityStatuses)"
              }
            },
            "required": [
              "status_id"
            ]
          }
        ]
      },
      "ChatAttachmentInput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ChatAttachmentInputInput",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "The name of the file"
          },
          "url": {
            "description": "The URL of the file (mutually exclusive with base64)",
            "type": "string"
          },
          "base64": {
            "description": "Base64-encoded file content (mutually exclusive with url). Can be a data URL (data:mimetype;base64,...) or raw base64 string.",
            "type": "string"
          },
          "mime_type": {
            "description": "MIME type of the file (e.g., \"image/png\", \"application/pdf\"). Optional if using data URL format or if type can be detected from file content.",
            "type": "string"
          }
        },
        "required": [
          "name"
        ]
      },
      "PublicContactsFilter": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/PublicContactsFilterInput",
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "all_contacts"
              }
            },
            "required": [
              "type"
            ]
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "contact_id_in"
              },
              "contact_ids": {
                "type": "array",
                "items": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                }
              }
            },
            "required": [
              "type",
              "contact_ids"
            ]
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "contacts_created_at_between"
              },
              "after": {},
              "before": {}
            },
            "required": [
              "type"
            ]
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "contacts_email_domain_name_in"
              },
              "domain_name_in": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "type",
              "domain_name_in"
            ]
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "contacts_name_in"
              },
              "name_in": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "type",
              "name_in"
            ]
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "contacts_phone_number_in"
              },
              "phone_number_in": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Full phone numbers, matched exactly on digits (formatting like +, spaces, and dashes is ignored). Use * inside an entry for partial/substring matching."
              }
            },
            "required": [
              "type",
              "phone_number_in"
            ]
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "contacts_email_in"
              },
              "email_in": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "type",
              "email_in"
            ]
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "contacts_attributes_in"
              },
              "attributes": {
                "type": "array",
                "items": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {
                    "type": "string"
                  }
                }
              }
            },
            "required": [
              "type"
            ]
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "contacts_affected_by_sequence"
              },
              "sequence_id": {
                "type": "string"
              }
            },
            "required": [
              "type",
              "sequence_id"
            ]
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "last_contacted_at_between"
              },
              "after": {},
              "before": {}
            },
            "required": [
              "type"
            ]
          }
        ]
      },
      "PublicContactsCompositeFilter": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/PublicContactsCompositeFilterInput",
        "type": "object",
        "properties": {
          "or": {
            "minItems": 1,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "and": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PublicContactsFilter"
                  }
                }
              },
              "required": [
                "and"
              ]
            }
          }
        },
        "required": [
          "or"
        ]
      },
      "PublicAPIHttpOverrides": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/PublicAPIHttpOverridesInput",
        "type": "object",
        "properties": {
          "query_params": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "string"
            }
          },
          "path_params": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "string"
            }
          },
          "body_params": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "string"
            }
          },
          "headers": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "string"
            }
          }
        }
      },
      "LanguageIsoCodeValues": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/LanguageIsoCodeValuesInput",
        "type": "string",
        "enum": [
          "en",
          "fr",
          "de",
          "nl",
          "pl",
          "pt",
          "es",
          "it",
          "ru",
          "ja",
          "ko",
          "zh",
          "ar",
          "tr",
          "sv",
          "da",
          "no",
          "fi",
          "el",
          "cs",
          "hu",
          "th",
          "vi",
          "id",
          "he",
          "hi",
          "uk",
          "ro",
          "bg",
          "hr",
          "sk",
          "sl",
          "sr",
          "et",
          "lv",
          "lt",
          "is",
          "ga",
          "ms",
          "tl",
          "fa",
          "bn",
          "ta",
          "te",
          "ur",
          "sw",
          "zu",
          "af",
          "sq",
          "hy",
          "az",
          "eu",
          "be",
          "bs",
          "ca",
          "cy",
          "ku",
          "ckb",
          "kmr"
        ]
      },
      "AuthenticateUserPayloadDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/AuthenticateUserPayloadDtoInput",
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "format": "email",
            "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
          },
          "mcp_access": {
            "type": "object",
            "properties": {
              "server_ids": {
                "maxItems": 50,
                "type": "array",
                "items": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                }
              },
              "account_id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              }
            }
          },
          "name": {
            "type": "string"
          },
          "avatar_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "phone": {
            "type": "string"
          },
          "language": {
            "$ref": "#/components/schemas/LanguageIsoCodeValues"
          },
          "customData": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "number"
                },
                {
                  "type": "boolean"
                }
              ]
            }
          },
          "chat_context": {
            "type": "string"
          },
          "http_action_overrides": {
            "$ref": "#/components/schemas/PublicAPIHttpOverrides"
          }
        },
        "required": [
          "email"
        ]
      },
      "AuthenticateUserByPhonePayloadDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/AuthenticateUserByPhonePayloadDtoInput",
        "type": "object",
        "properties": {
          "mcp_access": {
            "type": "object",
            "properties": {
              "server_ids": {
                "maxItems": 50,
                "type": "array",
                "items": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                }
              },
              "account_id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              }
            }
          },
          "name": {
            "type": "string"
          },
          "phone": {
            "type": "string",
            "description": "Phone number including the country code, e.g. +14155550123"
          },
          "language": {
            "$ref": "#/components/schemas/LanguageIsoCodeValues"
          },
          "customData": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "number"
                },
                {
                  "type": "boolean"
                }
              ]
            }
          },
          "chat_context": {
            "type": "string"
          },
          "http_action_overrides": {
            "$ref": "#/components/schemas/PublicAPIHttpOverrides"
          }
        },
        "required": [
          "phone"
        ]
      },
      "AuthenticateUserByExternalIdPayloadDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/AuthenticateUserByExternalIdPayloadDtoInput",
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "format": "email",
            "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
          },
          "mcp_access": {
            "type": "object",
            "properties": {
              "server_ids": {
                "maxItems": 50,
                "type": "array",
                "items": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                }
              },
              "account_id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              }
            }
          },
          "name": {
            "type": "string"
          },
          "avatar_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "phone": {
            "type": "string"
          },
          "language": {
            "$ref": "#/components/schemas/LanguageIsoCodeValues"
          },
          "customData": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "number"
                },
                {
                  "type": "boolean"
                }
              ]
            }
          },
          "chat_context": {
            "type": "string"
          },
          "http_action_overrides": {
            "$ref": "#/components/schemas/PublicAPIHttpOverrides"
          },
          "external_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255,
            "description": "The user's stable id in your system. The contact is matched by this id alone, so email and phone can change or be shared with other contacts."
          },
          "primary_external_id": {
            "description": "The primary account's external_id within your organization. The primary contact does not need to exist yet. Chains and indirect cycles are allowed; direct self-links are rejected. Omit to preserve the current value, send null to unlink, or send a string to set or replace it. The reference does not merge contacts or change customer access. Dashboard contact history can include all connected contacts, subject to the viewer’s session permissions.",
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 255
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "external_id"
        ]
      },
      "SaveContactInput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SaveContactInputInput",
        "type": "object",
        "properties": {
          "contact": {
            "type": "object",
            "properties": {
              "email": {
                "type": "string",
                "format": "email",
                "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
              },
              "phone": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "custom_data": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": "string"
                }
              },
              "http_action_overrides": {
                "$ref": "#/components/schemas/PublicAPIHttpOverrides"
              }
            }
          }
        },
        "required": [
          "contact"
        ]
      },
      "UpdateContactInput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdateContactInputInput",
        "type": "object",
        "properties": {
          "contact": {
            "type": "object",
            "properties": {
              "email": {
                "type": "string",
                "format": "email",
                "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
              },
              "phone": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "custom_data": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": "string"
                }
              },
              "http_action_overrides": {
                "$ref": "#/components/schemas/PublicAPIHttpOverrides"
              }
            }
          }
        },
        "required": [
          "contact"
        ]
      },
      "SearchContactsInput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SearchContactsInputInput",
        "type": "object",
        "properties": {
          "filter": {
            "$ref": "#/components/schemas/PublicContactsCompositeFilter"
          },
          "cursor": {
            "description": "Pagination cursor to fetch the next set of results",
            "type": "string"
          }
        },
        "required": [
          "filter"
        ]
      },
      "CreateChatSessionInput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CreateChatSessionInputInput",
        "type": "object",
        "properties": {
          "contact_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "channel": {
            "default": {
              "type": "api"
            },
            "type": "object",
            "properties": {
              "type": {
                "$ref": "#/components/schemas/SessionChannel"
              }
            },
            "required": [
              "type"
            ]
          },
          "verified": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ]
          },
          "custom_data": {
            "description": "Session-level custom data to store on the chat session.",
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "number"
                },
                {
                  "type": "boolean"
                }
              ]
            }
          },
          "contact": {
            "description": "Contact to associate with the session. When provided (and no contact_id is given) a contact is created/updated and linked to the session; its custom_data is persisted on the contact. Honors the top-level `verified` flag — verified contacts write to custom_data, otherwise to non_verified_custom_data.",
            "type": "object",
            "properties": {
              "email": {
                "type": "string",
                "format": "email",
                "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
              },
              "name": {
                "type": "string"
              },
              "phone_number": {
                "type": "string"
              },
              "custom_data": {
                "description": "Custom data to store on the contact for this session.",
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "UpdateChatSessionInput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdateChatSessionInputInput",
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "open",
              "closed_resolved",
              "closed_unresolved"
            ]
          },
          "generate_summary_and_sentiment_on_resolve": {
            "type": "boolean"
          },
          "reflect_status_change_for_integration": {
            "type": "boolean"
          },
          "session_closed_payload": {
            "anyOf": [
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              },
              {
                "type": "string"
              }
            ]
          },
          "summary": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 10000
              },
              {
                "type": "null"
              }
            ],
            "description": "Replace the session summary, or null to clear it. Takes precedence over a summary generated on resolve."
          }
        }
      },
      "SessionAssigneeUpdateInput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SessionAssigneeUpdateInputInput",
        "type": "object",
        "properties": {
          "assignee_id": {
            "description": "Agent user ID to assign, or null to unassign the session",
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "assignee_email": {
            "description": "Email of the agent to assign, matched case-insensitively against this organization’s members, or null to unassign the session",
            "anyOf": [
              {
                "type": "string",
                "format": "email",
                "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "SessionTeamTransferInput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SessionTeamTransferInputInput",
        "type": "object",
        "properties": {
          "team_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
            "description": "Team ID to transfer the session to"
          }
        },
        "required": [
          "team_id"
        ]
      },
      "SessionTagMutationInput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SessionTagMutationInputInput",
        "type": "object",
        "properties": {
          "tag_name": {
            "type": "string",
            "minLength": 1,
            "description": "Tag to add to the session"
          }
        },
        "required": [
          "tag_name"
        ]
      },
      "SendMessageInput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SendMessageInputInput",
        "type": "object",
        "properties": {
          "sender": {
            "type": "string",
            "enum": [
              "contact",
              "agent"
            ]
          },
          "contact": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "email": {
                "type": "string",
                "format": "email",
                "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
              },
              "phone_number": {
                "type": "string"
              },
              "avatar_url": {
                "type": "string"
              },
              "custom_data": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": "string"
                }
              }
            }
          },
          "custom_data": {
            "description": "Session-level custom data to merge into the chat session. Use contact.custom_data for contact-level attributes.",
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "number"
                },
                {
                  "type": "boolean"
                }
              ]
            }
          },
          "agent": {
            "type": "object",
            "properties": {
              "id": {
                "type": "number"
              },
              "name": {
                "type": "string"
              },
              "avatar_url": {
                "type": "string"
              }
            }
          },
          "message": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "text"
              },
              "text": {
                "type": "string"
              },
              "attachments": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ChatAttachmentInput"
                }
              },
              "option_reply": {
                "description": "Contact messages only: the message is a tap on one of an agent message's options (see the `options` on the conversation.agent_response webhook). The message is recorded with the option's label as its text; an option that is not on a message of this session is rejected with a 400.",
                "type": "object",
                "properties": {
                  "message_id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                    "description": "The agent message whose option was tapped."
                  },
                  "option_id": {
                    "type": "string",
                    "description": "The id of the tapped option."
                  }
                },
                "required": [
                  "message_id",
                  "option_id"
                ]
              }
            },
            "required": [
              "type",
              "text"
            ]
          },
          "should_take_over_session_from_ai": {
            "default": false,
            "type": "boolean"
          }
        },
        "required": [
          "sender",
          "message"
        ]
      },
      "CreateSessionCommentInput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CreateSessionCommentInputInput",
        "type": "object",
        "properties": {
          "thread_id": {
            "description": "Message UUID to attach the comment to. Omit to create a session-level note (not attached to any message).",
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "content": {
            "type": "string",
            "minLength": 1,
            "description": "Comment text content"
          },
          "agent_id": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991,
            "description": "Agent user ID that authors the comment"
          },
          "attachments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ChatAttachmentInput"
            }
          }
        },
        "required": [
          "content",
          "agent_id"
        ]
      },
      "UpdateSessionCommentInput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdateSessionCommentInputInput",
        "type": "object",
        "properties": {
          "content": {
            "type": "string",
            "minLength": 1,
            "description": "Replacement comment text content"
          },
          "agent_id": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991,
            "description": "Agent user ID performing the edit. Only the note's author may edit it."
          },
          "attachments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ChatAttachmentInput"
            }
          }
        },
        "required": [
          "content",
          "agent_id"
        ]
      },
      "FilterSessionsPublicDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/FilterSessionsPublicDtoInput",
        "type": "object",
        "properties": {
          "filters": {
            "default": {},
            "type": "object",
            "properties": {
              "date": {
                "description": "Date range filter on session creation time",
                "type": "object",
                "properties": {
                  "from": {
                    "description": "Start date (ISO 8601)",
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                  },
                  "to": {
                    "description": "End date (ISO 8601)",
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                  }
                }
              },
              "channels": {
                "description": "Filter by channels (web, email, whatsapp, phone_voice, sms, slack, etc.)",
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SessionChannel"
                }
              },
              "status": {
                "description": "Filter by built-in status codes (0 = open, 1 = closed_resolved, 2 = closed_unresolved)",
                "type": "array",
                "items": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 2147483647
                }
              },
              "sub_status_ids": {
                "description": "Filter by custom status ids (sessions whose `sub_status_id` is any of these). Ids come from GET /custom-statuses. An empty array applies no filter, like the other array filters here.",
                "type": "array",
                "items": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                }
              },
              "ai_closure": {
                "description": "Filter by AI closure type (e.g. \"handed_off\", \"resolved\", \"no_resolution\")",
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "assumed_resolved",
                    "handed_off",
                    "resolved"
                  ]
                }
              },
              "sentiment": {
                "description": "Filter by customer sentiment (angry, happy, neutral)",
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "angry",
                    "happy",
                    "neutral"
                  ]
                }
              },
              "assignees": {
                "description": "Filter by assignee user IDs (empty array = unassigned)",
                "type": "array",
                "items": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 2147483647
                }
              },
              "team_ids": {
                "description": "Filter by assigned team/group IDs. For the inbox Support Team filter, use support_team_ids. Use the \"$unassigned\" token to match sessions with no team.",
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "support_team_ids": {
                "description": "Filter by Support Team IDs (from GET /teams): the support team whose inbox contains the session. Distinct from team_ids and view-sharing permissions. Use the \"$unassigned\" token to match sessions with no support team.",
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "contact_ids": {
                "description": "Filter by contact IDs",
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "ticket_number": {
                "description": "Filter by exact ticket number",
                "type": "integer",
                "minimum": 0,
                "maximum": 2147483647
              },
              "language": {
                "description": "Filter by session language codes",
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "tags": {
                "description": "Filter by tag names (sessions must have ALL specified tags)",
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "waiting_on": {
                "description": "Filter by who the session is waiting on",
                "type": "string",
                "enum": [
                  "customers",
                  "human_agents"
                ]
              },
              "custom_data": {
                "description": "Filter by session custom data (OR between objects, AND within each object)",
                "type": "array",
                "items": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {
                    "type": "string"
                  }
                }
              },
              "customData": {
                "description": "Deprecated compatibility alias for custom_data",
                "anyOf": [
                  {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "string"
                      }
                    }
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "additionalProperties": false
          },
          "sort_by": {
            "description": "Sort field (default: last_message_at)",
            "type": "string",
            "enum": [
              "last_message_at",
              "created_at"
            ]
          },
          "sort_order": {
            "description": "Sort direction (default: desc)",
            "type": "string",
            "enum": [
              "asc",
              "desc"
            ]
          },
          "page": {
            "default": 1,
            "description": "Page number (1-based, default: 1)",
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 2147483647
          },
          "limit": {
            "default": 25,
            "description": "Results per page (1-100, default: 25)",
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 2147483647
          }
        }
      },
      "CreateChatSessionFollowUpInput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CreateChatSessionFollowUpInputInput",
        "type": "object",
        "properties": {
          "delay_minutes": {
            "type": "integer",
            "minimum": 1,
            "maximum": 43200,
            "description": "Minutes from now until the AI continues the session (1–43200, i.e. up to 30 days). The reply runs at the first whole minute at or after that moment."
          },
          "prompt": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4000,
            "description": "Guidance for the fired reply — what to check or say when the session is continued. Not shown to the contact."
          }
        },
        "required": [
          "delay_minutes",
          "prompt"
        ]
      },
      "CreateContactSegmentInput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CreateContactSegmentInputInput",
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "description": {
            "description": "Optional description; defaults to null",
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "definition": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "or": {
                    "minItems": 1,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "and": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/ContactsFilter"
                          }
                        }
                      },
                      "required": [
                        "and"
                      ]
                    }
                  }
                },
                "required": [
                  "or"
                ]
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "name",
          "definition"
        ]
      },
      "UpdateContactSegmentInput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdateContactSegmentInputInput",
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "definition": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "or": {
                    "minItems": 1,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "and": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/ContactsFilter"
                          }
                        }
                      },
                      "required": [
                        "and"
                      ]
                    }
                  }
                },
                "required": [
                  "or"
                ]
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "UpdatePublicKnowledgebaseItem": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdatePublicKnowledgebaseItemInput",
        "type": "object",
        "properties": {
          "restricted_to_segments": {
            "description": "Contact segment ids this item should be restricted to. Pass [] to make it available to all contacts.",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "restricted_to_channels": {
            "description": "Channels this item should be restricted to. Pass [] to make it available on all channels.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SessionChannel"
            }
          },
          "start_time": {
            "description": "ISO 8601 instant (UTC) when the AI may start using this item. Null clears it.",
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "end_time": {
            "description": "ISO 8601 instant (UTC) when the AI stops using this item. Null clears it.",
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "visibility": {
            "type": "string",
            "enum": [
              "internal",
              "public"
            ]
          },
          "title": {
            "type": "string"
          }
        }
      },
      "UpdateAutopilotInputDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdateAutopilotInputDtoInput",
        "type": "object",
        "properties": {
          "channel": {
            "type": "string",
            "enum": [
              "web",
              "email",
              "phone",
              "whatsapp",
              "slack",
              "sms",
              "instagram",
              "messenger",
              "api",
              "web_voice"
            ],
            "description": "Channel to update: web, email, phone, whatsapp, slack, sms, instagram, messenger, api, web_voice"
          },
          "autopilot_enabled": {
            "type": "boolean",
            "description": "Set true to enable autopilot, false to disable"
          },
          "ai_agent_version": {
            "description": "AI agent version to use for this channel",
            "type": "string",
            "enum": [
              "v1",
              "v2"
            ]
          }
        },
        "required": [
          "channel",
          "autopilot_enabled"
        ]
      },
      "UpdateProhibitedTopicsInputDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdateProhibitedTopicsInputDtoInput",
        "type": "object",
        "properties": {
          "topics": {
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string",
                      "maxLength": 255
                    },
                    "description": {
                      "description": "Guidance for when a session matches this topic. Omit it to keep the stored description; pass null to clear it.",
                      "anyOf": [
                        {
                          "type": "string",
                          "maxLength": 500
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "name"
                  ]
                }
              ]
            },
            "description": "Full replacement list of prohibited topics. Each entry is either a name string or an object with a name and an optional description. A name-only entry keeps whatever description that topic already has. Empty array clears all topics. Duplicates and blank entries are removed."
          }
        },
        "required": [
          "topics"
        ]
      },
      "UpdatePublicEmailChannelTemplateDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdatePublicEmailChannelTemplateDtoInput",
        "type": "object",
        "properties": {
          "html_template": {
            "description": "Full HTML template wrapping outbound emails. When null/empty, falls back to a built-in default. Required slot: {{content}}. Optional slots: {{ticket_number}}, {{zendesk_ticket_id}}, {{session.language}}, {{agent_name}}, {{agent_title}}, {{agent_email}}, {{quoted_content}}. Agent slots are empty while only the AI has handled the session; {{agent_email}} is also empty when an alias masks the agent (showing first names only does not hide it). Supports {{#if expr}}...{{else}}...{{/if}} conditionals.",
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "EmailRecipient": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/EmailRecipientInput",
        "type": "object",
        "properties": {
          "to_email": {
            "type": "string",
            "format": "email",
            "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
          },
          "email_body": {
            "type": "string"
          },
          "email_subject": {
            "type": "string"
          },
          "email_sender_name": {
            "type": "string"
          },
          "email_is_transactional": {
            "type": "boolean"
          }
        },
        "required": [
          "to_email"
        ]
      },
      "SendEmailInput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SendEmailInputInput",
        "type": "object",
        "properties": {
          "from_email": {
            "type": "string",
            "format": "email",
            "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
          },
          "recipients": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EmailRecipient"
            }
          },
          "delay_in_minutes": {
            "type": "number",
            "exclusiveMinimum": 0
          },
          "fallback_email_subject": {
            "type": "string"
          },
          "fallback_email_sender_name": {
            "type": "string"
          },
          "fallback_email_body": {
            "type": "string"
          }
        },
        "required": [
          "from_email",
          "recipients"
        ]
      },
      "PutCustomDomainInput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/PutCustomDomainInputInput",
        "type": "object",
        "properties": {
          "domainName": {
            "type": "string"
          },
          "region": {
            "description": "Sending region: EU (Ireland) or US (North Virginia). Defaults to eu-west-1 for new domains. Cannot be changed after creation.",
            "type": "string",
            "enum": [
              "eu-west-1",
              "us-east-1"
            ]
          }
        },
        "required": [
          "domainName"
        ]
      },
      "UpdateMacroSettingsDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdateMacroSettingsDtoInput",
        "type": "object",
        "properties": {
          "translation_languages": {
            "maxItems": 10,
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The full list of language codes (lower-case, such as `es`; at most 10, each from `supported_translation_languages`, no repeats) to translate every org-wide macro into. It replaces the current list, so send every language you want to keep. `[]` turns macro translation off."
          }
        },
        "required": [
          "translation_languages"
        ]
      },
      "CreateOfficeHoursPublicDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CreateOfficeHoursPublicDtoInput",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Schedule name (e.g. \"Business Hours\", \"Weekend Support\")"
          },
          "iana_timezone": {
            "type": "string",
            "description": "IANA timezone for the schedule (e.g. \"America/New_York\", \"Europe/London\", \"Asia/Tokyo\")"
          },
          "exceptions": {
            "description": "Omit to preserve existing exceptions; send [] to clear them",
            "maxItems": 200,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OfficeHoursExceptionDto"
            }
          },
          "shifts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "day_of_week": {
                  "type": "string",
                  "enum": [
                    "everyday",
                    "friday",
                    "friday_and_saturday",
                    "monday",
                    "monday_to_friday",
                    "saturday",
                    "sunday",
                    "sunday_and_monday",
                    "sunday_to_thursday",
                    "thursday",
                    "tuesday",
                    "wednesday"
                  ],
                  "description": "Day(s) of week: \"monday\", \"tuesday\", \"wednesday\", \"thursday\", \"friday\", \"saturday\", \"sunday\", \"everyday\", \"monday_to_friday\", \"sunday_to_thursday\", \"friday_and_saturday\", \"sunday_and_monday\""
                },
                "start_time": {
                  "type": "string",
                  "description": "Start time in HH:mm:ss format (e.g. \"09:00:00\")"
                },
                "end_time": {
                  "type": "string",
                  "description": "End time in HH:mm:ss format (e.g. \"17:00:00\")"
                }
              },
              "required": [
                "day_of_week",
                "start_time",
                "end_time"
              ]
            },
            "description": "Time blocks when support is available. Use day ranges like \"monday_to_friday\" for convenience."
          }
        },
        "required": [
          "name",
          "iana_timezone",
          "shifts"
        ]
      },
      "UpdateOfficeHoursPublicDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdateOfficeHoursPublicDtoInput",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Updated schedule name"
          },
          "iana_timezone": {
            "type": "string",
            "description": "Updated IANA timezone"
          },
          "exceptions": {
            "description": "Omit to preserve existing exceptions; send [] to clear them",
            "maxItems": 200,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OfficeHoursExceptionDto"
            }
          },
          "shifts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "Shift ID (from the existing schedule)"
                },
                "day_of_week": {
                  "type": "string",
                  "enum": [
                    "everyday",
                    "friday",
                    "friday_and_saturday",
                    "monday",
                    "monday_to_friday",
                    "saturday",
                    "sunday",
                    "sunday_and_monday",
                    "sunday_to_thursday",
                    "thursday",
                    "tuesday",
                    "wednesday"
                  ],
                  "description": "Day(s) of week: \"monday\", \"tuesday\", \"wednesday\", \"thursday\", \"friday\", \"saturday\", \"sunday\", \"everyday\", \"monday_to_friday\", \"sunday_to_thursday\", \"friday_and_saturday\", \"sunday_and_monday\""
                },
                "start_time": {
                  "type": "string",
                  "description": "Start time in HH:mm:ss format (e.g. \"09:00:00\")"
                },
                "end_time": {
                  "type": "string",
                  "description": "End time in HH:mm:ss format (e.g. \"17:00:00\")"
                }
              },
              "required": [
                "id",
                "day_of_week",
                "start_time",
                "end_time"
              ]
            },
            "description": "Complete list of shifts — replaces all existing shifts"
          }
        },
        "required": [
          "name",
          "iana_timezone",
          "shifts"
        ]
      },
      "CreateCustomStatusDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CreateCustomStatusDtoInput",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "Internal name shown to agents in the inbox (unique per organization, 1-100 chars)"
          },
          "description": {
            "description": "Internal note for agents on when to use this status. Never shown to customers.",
            "type": "string"
          },
          "parent_status": {
            "type": "string",
            "enum": [
              "closed_resolved",
              "closed_unresolved",
              "open"
            ],
            "description": "Built-in status this custom status refines: \"open\", \"closed_resolved\", or \"closed_unresolved\". Applying the custom status to a session moves the session to this built-in status, so an \"open\"-parented status reopens a closed session and a \"closed_*\"-parented one closes it."
          },
          "display_name": {
            "description": "Customer-facing label (max 100 chars). Falls back to `name` when omitted.",
            "type": "string",
            "maxLength": 100
          },
          "display_description": {
            "description": "Customer-facing explanation. No fallback: when omitted, customers see no description.",
            "type": "string"
          },
          "color": {
            "description": "Badge color as #RRGGBB. Omit to inherit the parent status color.",
            "type": "string",
            "pattern": "^#[0-9a-fA-F]{6}$"
          },
          "icon": {
            "description": "Inline SVG markup for the badge icon (sanitized server-side, max 10,000 chars). Omit for the default icon.",
            "type": "string",
            "maxLength": 10000,
            "pattern": "^<svg[\\s>]"
          },
          "allowed_group_ids": {
            "description": "Team ids whose agents may set this status from the inbox. Omit or pass [] to allow every team. Admins, API keys, and workflows can always set it.",
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "name",
          "parent_status"
        ]
      },
      "UpdateCustomStatusPublicDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdateCustomStatusPublicDtoInput",
        "type": "object",
        "properties": {
          "name": {
            "description": "Internal name shown to agents (unique per organization, 1-100 chars)",
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "description": {
            "description": "Internal note for agents on when to use this status",
            "type": "string"
          },
          "parent_status": {
            "description": "Built-in status this custom status refines: \"open\", \"closed_resolved\", or \"closed_unresolved\". Applying the custom status to a session moves the session to this built-in status, so an \"open\"-parented status reopens a closed session and a \"closed_*\"-parented one closes it. Moving a status across the open/closed boundary drops its ticketing-system stage mappings.",
            "type": "string",
            "enum": [
              "closed_resolved",
              "closed_unresolved",
              "open"
            ]
          },
          "display_name": {
            "description": "Customer-facing label (max 100 chars). null clears it back to `name`; omit to leave unchanged.",
            "anyOf": [
              {
                "type": "string",
                "maxLength": 100
              },
              {
                "type": "null"
              }
            ]
          },
          "display_description": {
            "description": "Customer-facing explanation. null clears it; omit to leave unchanged.",
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "color": {
            "description": "Badge color as #RRGGBB. null restores the parent status color; omit to leave unchanged.",
            "anyOf": [
              {
                "type": "string",
                "pattern": "^#[0-9a-fA-F]{6}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "icon": {
            "description": "Inline SVG markup for the badge icon. null restores the default icon; omit to leave unchanged.",
            "anyOf": [
              {
                "type": "string",
                "maxLength": 10000,
                "pattern": "^<svg[\\s>]"
              },
              {
                "type": "null"
              }
            ]
          },
          "allowed_group_ids": {
            "description": "Replaces the list of team ids whose agents may set this status. [] allows every team; omit to leave unchanged.",
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "CreateInboxViewDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CreateInboxViewDtoInput",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "Name shown in the inbox view picker"
          },
          "filters": {
            "default": {},
            "description": "Filters the view applies, ANDed together. Omit for a view over every session. Same vocabulary as POST /chat/sessions/filter, plus the saved-view-only `$current_user` assignee token and rolling `date.preset`.",
            "type": "object",
            "properties": {
              "date": {
                "description": "Date range filter on session creation time",
                "type": "object",
                "properties": {
                  "from": {
                    "description": "Start date (ISO 8601)",
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                  },
                  "to": {
                    "description": "End date (ISO 8601)",
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                  },
                  "preset": {
                    "description": "Rolling window resolved every time the view is opened: \"today\", \"last_3_days\" or \"last_7_days\". Mutually exclusive with from/to.",
                    "type": "string",
                    "enum": [
                      "today",
                      "last_3_days",
                      "last_7_days"
                    ]
                  }
                }
              },
              "channels": {
                "description": "Filter by channels (web, email, whatsapp, phone_voice, sms, slack, etc.)",
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SessionChannel"
                }
              },
              "status": {
                "description": "Filter by built-in status codes (0 = open, 1 = closed_resolved, 2 = closed_unresolved)",
                "type": "array",
                "items": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 2147483647
                }
              },
              "sub_status_ids": {
                "description": "Filter by custom status ids (sessions whose `sub_status_id` is any of these). Ids come from GET /custom-statuses. An empty array applies no filter, like the other array filters here.",
                "type": "array",
                "items": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                }
              },
              "ai_closure": {
                "description": "Filter by AI closure type (e.g. \"handed_off\", \"resolved\", \"no_resolution\")",
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "assumed_resolved",
                    "handed_off",
                    "resolved"
                  ]
                }
              },
              "sentiment": {
                "description": "Filter by customer sentiment (angry, happy, neutral)",
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "angry",
                    "happy",
                    "neutral"
                  ]
                }
              },
              "assignees": {
                "description": "Filter by assignee user IDs (empty array = unassigned). The \"$current_user\" token resolves to whoever opens the view, so one shared view can mean \"assigned to me\" for every teammate.",
                "type": "array",
                "items": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 2147483647
                    },
                    {
                      "type": "string",
                      "const": "$current_user"
                    }
                  ]
                }
              },
              "team_ids": {
                "description": "Filter by assigned team/group IDs. For the inbox Support Team filter, use support_team_ids. Use the \"$unassigned\" token to match sessions with no team.",
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "support_team_ids": {
                "description": "Filter by Support Team IDs (from GET /teams): the support team whose inbox contains the session. Distinct from team_ids and view-sharing permissions. Use the \"$unassigned\" token to match sessions with no support team.",
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "contact_ids": {
                "description": "Filter by contact IDs",
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "ticket_number": {
                "description": "Filter by exact ticket number",
                "type": "integer",
                "minimum": 0,
                "maximum": 2147483647
              },
              "language": {
                "description": "Filter by session language codes",
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "tags": {
                "description": "Filter by tag names (sessions must have ALL specified tags)",
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "waiting_on": {
                "description": "Filter by who the session is waiting on",
                "type": "string",
                "enum": [
                  "customers",
                  "human_agents"
                ]
              },
              "custom_data": {
                "description": "Filter by session custom data (OR between objects, AND within each object)",
                "type": "array",
                "items": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {
                    "type": "string"
                  }
                }
              }
            },
            "additionalProperties": false
          },
          "sort_by": {
            "description": "Sort field (default: last_message_at)",
            "type": "string",
            "enum": [
              "last_message_at",
              "created_at",
              "sla_urgency",
              "snoozed_until"
            ]
          },
          "sort_order": {
            "description": "Sort direction (default: desc)",
            "type": "string",
            "enum": [
              "asc",
              "desc"
            ]
          },
          "group_by": {
            "description": "Group the session list by this field. Omit for a flat list.",
            "type": "string",
            "enum": [
              "tags",
              "contact_attribute",
              "session_attribute",
              "channel",
              "assignee_id",
              "status",
              "sub_status_id",
              "ai_closure_type",
              "language",
              "inbox_id"
            ]
          },
          "group_by_attribute": {
            "description": "Exact attribute key for contact_attribute or session_attribute grouping. Missing or empty leaves the list ungrouped.",
            "type": "string"
          },
          "shared_with_user_ids": {
            "default": [],
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            "description": "User ids the view is shared with. Leave both share lists empty to share the view with the whole organization. Name users and/or teams to restrict it to them, or pass only your own user id to keep it private. Sharing requires the `sessions-shared-views:write` permission — without it a created view is locked to its creator and the share lists on an update are ignored."
          },
          "shared_with_team_ids": {
            "default": [],
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Team ids (from GET /teams) whose members can see the view."
          }
        },
        "required": [
          "name"
        ]
      },
      "UpdateInboxViewDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdateInboxViewDtoInput",
        "type": "object",
        "properties": {
          "name": {
            "description": "New name for the view",
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "filters": {
            "description": "Replaces the entire saved filter set — including the OR/exclude groups of an `advanced` view. Omit to leave the query untouched.",
            "type": "object",
            "properties": {
              "date": {
                "description": "Date range filter on session creation time",
                "type": "object",
                "properties": {
                  "from": {
                    "description": "Start date (ISO 8601)",
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                  },
                  "to": {
                    "description": "End date (ISO 8601)",
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                  },
                  "preset": {
                    "description": "Rolling window resolved every time the view is opened: \"today\", \"last_3_days\" or \"last_7_days\". Mutually exclusive with from/to.",
                    "type": "string",
                    "enum": [
                      "today",
                      "last_3_days",
                      "last_7_days"
                    ]
                  }
                }
              },
              "channels": {
                "description": "Filter by channels (web, email, whatsapp, phone_voice, sms, slack, etc.)",
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SessionChannel"
                }
              },
              "status": {
                "description": "Filter by built-in status codes (0 = open, 1 = closed_resolved, 2 = closed_unresolved)",
                "type": "array",
                "items": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 2147483647
                }
              },
              "sub_status_ids": {
                "description": "Filter by custom status ids (sessions whose `sub_status_id` is any of these). Ids come from GET /custom-statuses. An empty array applies no filter, like the other array filters here.",
                "type": "array",
                "items": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                }
              },
              "ai_closure": {
                "description": "Filter by AI closure type (e.g. \"handed_off\", \"resolved\", \"no_resolution\")",
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "assumed_resolved",
                    "handed_off",
                    "resolved"
                  ]
                }
              },
              "sentiment": {
                "description": "Filter by customer sentiment (angry, happy, neutral)",
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "angry",
                    "happy",
                    "neutral"
                  ]
                }
              },
              "assignees": {
                "description": "Filter by assignee user IDs (empty array = unassigned). The \"$current_user\" token resolves to whoever opens the view, so one shared view can mean \"assigned to me\" for every teammate.",
                "type": "array",
                "items": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 2147483647
                    },
                    {
                      "type": "string",
                      "const": "$current_user"
                    }
                  ]
                }
              },
              "team_ids": {
                "description": "Filter by assigned team/group IDs. For the inbox Support Team filter, use support_team_ids. Use the \"$unassigned\" token to match sessions with no team.",
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "support_team_ids": {
                "description": "Filter by Support Team IDs (from GET /teams): the support team whose inbox contains the session. Distinct from team_ids and view-sharing permissions. Use the \"$unassigned\" token to match sessions with no support team.",
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "contact_ids": {
                "description": "Filter by contact IDs",
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "ticket_number": {
                "description": "Filter by exact ticket number",
                "type": "integer",
                "minimum": 0,
                "maximum": 2147483647
              },
              "language": {
                "description": "Filter by session language codes",
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "tags": {
                "description": "Filter by tag names (sessions must have ALL specified tags)",
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "waiting_on": {
                "description": "Filter by who the session is waiting on",
                "type": "string",
                "enum": [
                  "customers",
                  "human_agents"
                ]
              },
              "custom_data": {
                "description": "Filter by session custom data (OR between objects, AND within each object)",
                "type": "array",
                "items": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {
                    "type": "string"
                  }
                }
              }
            },
            "additionalProperties": false
          },
          "sort_by": {
            "description": "New sort field",
            "type": "string",
            "enum": [
              "last_message_at",
              "created_at",
              "sla_urgency",
              "snoozed_until"
            ]
          },
          "sort_order": {
            "description": "New sort direction",
            "type": "string",
            "enum": [
              "asc",
              "desc"
            ]
          },
          "group_by": {
            "description": "New grouping field; null removes grouping. Omit to leave it unchanged.",
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "tags",
                  "contact_attribute",
                  "session_attribute",
                  "channel",
                  "assignee_id",
                  "status",
                  "sub_status_id",
                  "ai_closure_type",
                  "language",
                  "inbox_id"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "group_by_attribute": {
            "description": "Attribute key for attribute grouping. Null clears the key. Omit to preserve it when the grouping field stays the same.",
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "shared_with_user_ids": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            "description": "User ids the view is shared with. Leave both share lists empty to share the view with the whole organization. Name users and/or teams to restrict it to them, or pass only your own user id to keep it private. Sharing requires the `sessions-shared-views:write` permission — without it a created view is locked to its creator and the share lists on an update are ignored."
          },
          "shared_with_team_ids": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Team ids (from GET /teams) whose members can see the view."
          }
        }
      },
      "CreateWorkflowPublicInput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CreateWorkflowPublicInputInput",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255,
            "description": "Workflow name"
          },
          "description": {
            "description": "Workflow description",
            "type": "string"
          },
          "trigger_type": {
            "type": "string",
            "enum": [
              "ivr-incoming-call",
              "manual-trigger",
              "ai-trigger",
              "cron-trigger",
              "form-trigger",
              "webhook",
              "contact-created",
              "contact-updated",
              "phone-call-started",
              "phone-call-finished",
              "ticket-created",
              "sub-session-created",
              "ticket-reassigned",
              "ticket-resolved",
              "ticket-handoff",
              "pre-ticket-handoff",
              "ticket-tag-added",
              "ticket-inactive",
              "agent-inactive",
              "csat-score-submit",
              "prohibited-topic-detected",
              "sla-first-reply-breached",
              "sla-next-reply-breached",
              "sla-resolution-breached",
              "voice-call-transferred",
              "pre-voice-call-transfer",
              "pre-phone-call-finished",
              "manual-ticket-trigger",
              "contact-message-received",
              "first-contact-message-received",
              "macro-called",
              "macro-option-clicked",
              "ai-response-completed",
              "agent-availability-changed",
              "agent-avail-in-team-changed",
              "ai-response-requested",
              "ticket-reopened",
              "agent-mentioned",
              "agent-message-posted",
              "ticket-team-changed",
              "session-updated",
              "sequence-contact-replied",
              "sequence-contact-completed",
              "sequence-contact-parked",
              "sequence-step-failed",
              "sequence-contact-suppressed"
            ],
            "description": "What starts the workflow. Use \"manual-trigger\" for on-demand execution, \"ai-trigger\" for AI-initiated, \"webhook\" for external HTTP triggers, \"cron-trigger\" for scheduled runs, or event-based triggers like \"ticket-created\", \"contact-created\", etc."
          },
          "trigger_configuration": {
            "description": "Trigger-specific configuration (e.g. cron expression for cron-trigger)",
            "anyOf": [
              {},
              {
                "type": "null"
              }
            ]
          },
          "workflow_blocks": {
            "type": "array",
            "items": {},
            "description": "Array of workflow steps and control-flow blocks. Each step is an object with { \"$kind\": \"Action\", \"id\": \"<unique-step-id>\", \"type\": \"<action-type>\", \"name\": \"<display-name>\", \"input\": { ... } }. Control-flow blocks use { \"$kind\": \"Block\", \"type\": \"if-else\", \"id\": \"<unique-id>\", \"inputs\": { \"condition\": { \"operatorName\": \"equals\", \"left\": \"{{step_id.field}}\", \"right\": \"value\" } }, \"branches\": { \"then\": [...steps], \"else\": [...steps] } }. Use {{step_id.field}} to reference outputs from previous steps (no `.output.` segment — the field sits directly under the step id)."
          },
          "workflow_editor_state": {
            "description": "React Flow editor state (nodes, edges, viewport) for the dashboard visual editor",
            "anyOf": [
              {},
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "name",
          "trigger_type",
          "workflow_blocks"
        ]
      },
      "UpdateWorkflowPublicInput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdateWorkflowPublicInputInput",
        "type": "object",
        "properties": {
          "name": {
            "description": "New workflow name",
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "description": {
            "description": "New workflow description",
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "trigger_type": {
            "description": "New trigger type",
            "type": "string",
            "enum": [
              "ivr-incoming-call",
              "manual-trigger",
              "ai-trigger",
              "cron-trigger",
              "form-trigger",
              "webhook",
              "contact-created",
              "contact-updated",
              "phone-call-started",
              "phone-call-finished",
              "ticket-created",
              "sub-session-created",
              "ticket-reassigned",
              "ticket-resolved",
              "ticket-handoff",
              "pre-ticket-handoff",
              "ticket-tag-added",
              "ticket-inactive",
              "agent-inactive",
              "csat-score-submit",
              "prohibited-topic-detected",
              "sla-first-reply-breached",
              "sla-next-reply-breached",
              "sla-resolution-breached",
              "voice-call-transferred",
              "pre-voice-call-transfer",
              "pre-phone-call-finished",
              "manual-ticket-trigger",
              "contact-message-received",
              "first-contact-message-received",
              "macro-called",
              "macro-option-clicked",
              "ai-response-completed",
              "agent-availability-changed",
              "agent-avail-in-team-changed",
              "ai-response-requested",
              "ticket-reopened",
              "agent-mentioned",
              "agent-message-posted",
              "ticket-team-changed",
              "session-updated",
              "sequence-contact-replied",
              "sequence-contact-completed",
              "sequence-contact-parked",
              "sequence-step-failed",
              "sequence-contact-suppressed"
            ]
          },
          "trigger_configuration": {
            "description": "New trigger configuration",
            "anyOf": [
              {},
              {
                "type": "null"
              }
            ]
          },
          "workflow_blocks": {
            "description": "New workflow step/block definitions (replaces existing blocks)",
            "type": "array",
            "items": {}
          },
          "workflow_editor_state": {
            "description": "React Flow editor state (nodes, edges, viewport) for the dashboard visual editor",
            "anyOf": [
              {},
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "ValidateWorkflowPublicInput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ValidateWorkflowPublicInputInput",
        "type": "object",
        "properties": {
          "trigger_type": {
            "type": "string",
            "enum": [
              "ivr-incoming-call",
              "manual-trigger",
              "ai-trigger",
              "cron-trigger",
              "form-trigger",
              "webhook",
              "contact-created",
              "contact-updated",
              "phone-call-started",
              "phone-call-finished",
              "ticket-created",
              "sub-session-created",
              "ticket-reassigned",
              "ticket-resolved",
              "ticket-handoff",
              "pre-ticket-handoff",
              "ticket-tag-added",
              "ticket-inactive",
              "agent-inactive",
              "csat-score-submit",
              "prohibited-topic-detected",
              "sla-first-reply-breached",
              "sla-next-reply-breached",
              "sla-resolution-breached",
              "voice-call-transferred",
              "pre-voice-call-transfer",
              "pre-phone-call-finished",
              "manual-ticket-trigger",
              "contact-message-received",
              "first-contact-message-received",
              "macro-called",
              "macro-option-clicked",
              "ai-response-completed",
              "agent-availability-changed",
              "agent-avail-in-team-changed",
              "ai-response-requested",
              "ticket-reopened",
              "agent-mentioned",
              "agent-message-posted",
              "ticket-team-changed",
              "session-updated",
              "sequence-contact-replied",
              "sequence-contact-completed",
              "sequence-contact-parked",
              "sequence-step-failed",
              "sequence-contact-suppressed"
            ],
            "description": "Trigger type to validate against"
          },
          "trigger_configuration": {
            "description": "Trigger configuration to validate against the trigger's configuration_def. When omitted, the trigger is validated as if unconfigured — triggers with required configuration (e.g. cron-trigger, ai-trigger) will report errors.",
            "anyOf": [
              {},
              {
                "type": "null"
              }
            ]
          },
          "workflow_blocks": {
            "type": "array",
            "items": {},
            "description": "Workflow blocks to validate"
          }
        },
        "required": [
          "trigger_type",
          "workflow_blocks"
        ]
      },
      "TestWorkflowPublicInput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/TestWorkflowPublicInputInput",
        "type": "object",
        "properties": {
          "trigger_payload": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "ivr-incoming-call",
                  "manual-trigger",
                  "ai-trigger",
                  "cron-trigger",
                  "form-trigger",
                  "webhook",
                  "contact-created",
                  "contact-updated",
                  "phone-call-started",
                  "phone-call-finished",
                  "ticket-created",
                  "sub-session-created",
                  "ticket-reassigned",
                  "ticket-resolved",
                  "ticket-handoff",
                  "pre-ticket-handoff",
                  "ticket-tag-added",
                  "ticket-inactive",
                  "agent-inactive",
                  "csat-score-submit",
                  "prohibited-topic-detected",
                  "sla-first-reply-breached",
                  "sla-next-reply-breached",
                  "sla-resolution-breached",
                  "voice-call-transferred",
                  "pre-voice-call-transfer",
                  "pre-phone-call-finished",
                  "manual-ticket-trigger",
                  "contact-message-received",
                  "first-contact-message-received",
                  "macro-called",
                  "macro-option-clicked",
                  "ai-response-completed",
                  "agent-availability-changed",
                  "agent-avail-in-team-changed",
                  "ai-response-requested",
                  "ticket-reopened",
                  "agent-mentioned",
                  "agent-message-posted",
                  "ticket-team-changed",
                  "session-updated",
                  "sequence-contact-replied",
                  "sequence-contact-completed",
                  "sequence-contact-parked",
                  "sequence-step-failed",
                  "sequence-contact-suppressed"
                ],
                "description": "Trigger type whose payload shape this synthetic payload should match"
              },
              "payload": {}
            },
            "required": [
              "type",
              "payload"
            ],
            "description": "Synthetic trigger event to dry-run the workflow against"
          }
        },
        "required": [
          "trigger_payload"
        ]
      },
      "UpdateOrganizationInputDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdateOrganizationInputDtoInput",
        "type": "object",
        "properties": {
          "name": {
            "description": "The name of the organization.",
            "type": "string",
            "minLength": 1
          }
        }
      },
      "UpdateSessionSidebarDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdateSessionSidebarDtoInput",
        "type": "object",
        "properties": {
          "card_order": {
            "description": "The new order, replacing the stored one. Entries are unique built-in card keys and `app:<mini app id>` entries.",
            "maxItems": 500,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          "hidden_cards": {
            "description": "The built-in card keys to hide, replacing the stored list.",
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "HandBackCallInput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/HandBackCallInputInput",
        "type": "object",
        "properties": {
          "session_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
            "description": "The session of the call to hand back, as received in the X-OPENCX-SESSION-ID SIP header"
          },
          "summary": {
            "description": "Your summary of the conversation so far. Saved as the session's summary before a teammate is connected.",
            "type": "string",
            "minLength": 1,
            "maxLength": 10000
          }
        },
        "required": [
          "session_id"
        ],
        "additionalProperties": false
      },
      "CreatePhoneAgentPublicDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CreatePhoneAgentPublicDtoInput",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Agent display name"
          },
          "type": {
            "description": "Agent type: \"inbound\" (receives calls, default) or \"outbound\" (makes calls)",
            "type": "string",
            "enum": [
              "inbound",
              "outbound"
            ]
          },
          "voice_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Voice ID from the /phone/voices endpoint. Omit for default voice."
          },
          "tts_provider": {
            "description": "Voice provider returned by the /phone/voices endpoint. It is inferred from voice_id when omitted.",
            "type": "string",
            "enum": [
              "elevenlabs",
              "cartesia"
            ]
          },
          "language": {
            "description": "ISO-639-1 language codes the agent should speak. Supported languages can be combined; Arabic accepts dialect tags such as \"ar-SA\".",
            "minItems": 1,
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "first_message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "What the agent says when it picks up (default: \"Hello?\")"
          },
          "instructions": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              {
                "type": "null"
              }
            ],
            "description": "The call prompt as an array of instruction blocks. Joined in order into the system prompt at call time. Sending this on update replaces the whole array."
          },
          "actionIds": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              {
                "type": "null"
              }
            ],
            "description": "HTTP actions the agent can call as tools during calls (action IDs from GET /actions). The full set is replaced on every write; send [] to detach all, omit or send null to leave it unchanged. IDs must belong to your organization."
          },
          "transfer_destination_ids": {
            "description": "Transfer destinations the agent may transfer calls to (IDs from GET /phone/transfer-destinations). The full set is replaced on every write; send [] to detach all. Destinations themselves are managed in the dashboard.",
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            }
          },
          "failover_transfer_destination_id": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              {
                "type": "null"
              }
            ],
            "description": "Destination the call is transferred to if the voice pipeline fails mid-call. Any destination of your organization; null falls back to the first allowed destination, then to a graceful hangup."
          },
          "tts_speed_pct": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 1,
                "maximum": 100
              },
              {
                "type": "null"
              }
            ],
            "description": "Speaking speed on a 1-100 scale (null = the voice default). Lower is slower; natural-sounding voices in some languages (e.g. Dutch) run best around 80-85."
          },
          "stt_keyterms": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              {
                "type": "null"
              }
            ],
            "description": "Custom vocabulary to boost in speech recognition: brand and product names, jargon, spellings the transcriber typically mishears. The agent name is merged in automatically."
          },
          "recording_enabled": {
            "description": "Record calls handled by this agent (default: false).",
            "type": "boolean"
          }
        },
        "required": [
          "name"
        ]
      },
      "UpdatePhoneAgentPublicDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdatePhoneAgentPublicDtoInput",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Agent display name"
          },
          "type": {
            "description": "Agent type: \"inbound\" (receives calls, default) or \"outbound\" (makes calls)",
            "type": "string",
            "enum": [
              "inbound",
              "outbound"
            ]
          },
          "voice_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Voice ID from the /phone/voices endpoint. Omit for default voice."
          },
          "tts_provider": {
            "description": "Voice provider returned by the /phone/voices endpoint. It is inferred from voice_id when omitted.",
            "type": "string",
            "enum": [
              "elevenlabs",
              "cartesia"
            ]
          },
          "language": {
            "description": "ISO-639-1 language codes the agent should speak. Supported languages can be combined; Arabic accepts dialect tags such as \"ar-SA\".",
            "minItems": 1,
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "first_message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "What the agent says when it picks up (default: \"Hello?\")"
          },
          "instructions": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              {
                "type": "null"
              }
            ],
            "description": "The call prompt as an array of instruction blocks. Joined in order into the system prompt at call time. Sending this on update replaces the whole array."
          },
          "actionIds": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              {
                "type": "null"
              }
            ],
            "description": "HTTP actions the agent can call as tools during calls (action IDs from GET /actions). The full set is replaced on every write; send [] to detach all, omit or send null to leave it unchanged. IDs must belong to your organization."
          },
          "transfer_destination_ids": {
            "description": "Transfer destinations the agent may transfer calls to (IDs from GET /phone/transfer-destinations). The full set is replaced on every write; send [] to detach all. Destinations themselves are managed in the dashboard.",
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            }
          },
          "failover_transfer_destination_id": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              {
                "type": "null"
              }
            ],
            "description": "Destination the call is transferred to if the voice pipeline fails mid-call. Any destination of your organization; null falls back to the first allowed destination, then to a graceful hangup."
          },
          "tts_speed_pct": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 1,
                "maximum": 100
              },
              {
                "type": "null"
              }
            ],
            "description": "Speaking speed on a 1-100 scale (null = the voice default). Lower is slower; natural-sounding voices in some languages (e.g. Dutch) run best around 80-85."
          },
          "stt_keyterms": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              {
                "type": "null"
              }
            ],
            "description": "Custom vocabulary to boost in speech recognition: brand and product names, jargon, spellings the transcriber typically mishears. The agent name is merged in automatically."
          },
          "recording_enabled": {
            "description": "Record calls handled by this agent (default: false).",
            "type": "boolean"
          }
        }
      },
      "SetPhoneAgentCallerNumberInput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SetPhoneAgentCallerNumberInputInput",
        "type": "object",
        "properties": {
          "caller_number": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1
              },
              {
                "type": "null"
              }
            ],
            "description": "A phone number verified in your workspace (E.164), or null to clear the caller ID. Clears the agent’s pool selection and keeps its assigned SIP trunk."
          }
        },
        "required": [
          "caller_number"
        ]
      },
      "WriteSecretInputDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/WriteSecretInputDtoInput",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120,
            "description": "The reference key actions and workflows use as {{secrets.<name>}}. Unique per organization, and immutable — writing the same name replaces its value rather than renaming anything."
          },
          "value": {
            "type": "string",
            "minLength": 1,
            "maxLength": 5000,
            "description": "The plaintext credential. Encrypted at rest and never returned by any endpoint."
          }
        },
        "required": [
          "name",
          "value"
        ]
      },
      "DiscoverCampaignPeopleDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/DiscoverCampaignPeopleDtoInput",
        "type": "object",
        "properties": {
          "query": {
            "type": "string",
            "minLength": 3,
            "maxLength": 500
          },
          "since": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
          },
          "max_insights": {
            "type": "integer",
            "minimum": 1,
            "maximum": 50
          },
          "max_people": {
            "type": "integer",
            "minimum": 1,
            "maximum": 5000
          },
          "min_similarity": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          }
        },
        "required": [
          "query"
        ]
      },
      "UpdateSlackNotificationSettingsInputDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdateSlackNotificationSettingsInputDtoInput",
        "type": "object",
        "properties": {
          "notification_channel_id": {
            "description": "Channel to post handoff notifications to. Must be a channel the bot is in (see GET /slack/bot-channels); its name is resolved from Slack. Pass null to turn channel notifications off while keeping Slack connected. Omit to leave unchanged.",
            "anyOf": [
              {
                "type": "string",
                "minLength": 1
              },
              {
                "type": "null"
              }
            ]
          },
          "notify_assignee_enabled": {
            "description": "Whether the assigned agent is DMed on assignment and handoff, and @mentioned in the Slack thread. Omit to leave unchanged.",
            "type": "boolean"
          }
        }
      },
      "UpdateSlackTagDirectoryInputDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdateSlackTagDirectoryInputDtoInput",
        "type": "object",
        "properties": {
          "tag_directory": {
            "type": "object",
            "propertyNames": {
              "type": "string",
              "minLength": 1
            },
            "additionalProperties": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "usergroup"
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "required": [
                    "type",
                    "id"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "user"
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "required": [
                    "type",
                    "id"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "channel"
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "required": [
                    "type",
                    "id"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "special"
                    },
                    "id": {
                      "type": "string",
                      "enum": [
                        "here",
                        "channel"
                      ]
                    }
                  },
                  "required": [
                    "type",
                    "id"
                  ]
                }
              ]
            }
          }
        },
        "required": [
          "tag_directory"
        ]
      },
      "UpdateGroupDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdateGroupDtoInput",
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "category_id": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              {
                "type": "null"
              }
            ]
          },
          "description": {
            "type": "string"
          },
          "is_support_enabled": {
            "type": "boolean"
          },
          "support_office_hours_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "support_assignment_strategy": {
            "type": "string",
            "enum": [
              "least-busy",
              "round-robin",
              "unassigned"
            ]
          },
          "call_wrap_up_seconds": {
            "description": "Team wrap-up in seconds. Null inherits the organization setting; zero disables wrap-up.",
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 3600
              },
              {
                "type": "null"
              }
            ]
          },
          "telephony_pacing_enabled": {
            "description": "Queue calls for this team and offer each call to one available agent at a time.",
            "type": "boolean"
          },
          "telephony_ring_seconds": {
            "type": "integer",
            "minimum": 10,
            "maximum": 120
          },
          "telephony_queue_wait_seconds": {
            "type": "integer",
            "minimum": 30,
            "maximum": 3600
          },
          "telephony_distribution": {
            "type": "string",
            "enum": [
              "fewest_answered_today",
              "longest_available"
            ]
          },
          "phone_sla_policy_id": {
            "description": "SLA policy whose phone answer-time target grades calls waiting in this team. Null uses the organization default.",
            "anyOf": [
              {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              {
                "type": "null"
              }
            ]
          },
          "call_recording_enabled": {
            "description": "Record calls answered by this team. When off, answering does not start a recording; one the phone agent or call flow already started keeps running.",
            "type": "boolean"
          },
          "call_languages": {
            "description": "Languages spoken on calls this team answers (language codes). Live transcripts of those calls stay in these languages; empty uses the organization default.",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "auto_assign_interval_seconds": {
            "description": "Seconds between automatic assignments to the same agent under the least-busy strategy: 0 turns pacing off, otherwise 15 to 3600.",
            "type": "integer",
            "minimum": 0,
            "maximum": 3600
          }
        }
      },
      "CreateTrainingPublicDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CreateTrainingPublicDtoInput",
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "description": "The scenario title or trigger phrase"
          },
          "content": {
            "type": "string",
            "description": "The instruction body — how the AI should respond"
          },
          "type": {
            "description": "BEHAVIORAL (always active) or SCENARIO_SPECIFIC (semantic match, default)",
            "type": "string",
            "enum": [
              "BEHAVIORAL",
              "SCENARIO_SPECIFIC"
            ]
          },
          "is_draft": {
            "description": "If true, saved as draft and not used by the AI",
            "type": "boolean"
          },
          "directory_id": {
            "description": "Directory ID to organize into",
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "restricted_to_channels": {
            "description": "Limit to specific channels (empty = all)",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SessionChannel"
            }
          },
          "restricted_to_segments": {
            "description": "Limit to specific segments (empty = all)",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "metadata": {
            "description": "Arbitrary key-value metadata for external integrations",
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "start_time": {
            "description": "ISO 8601 instant (UTC) when the AI may start using this instruction. Null clears the start bound.",
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "end_time": {
            "description": "ISO 8601 instant (UTC) when the AI stops using this instruction. Null clears the end bound.",
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "title",
          "content"
        ]
      },
      "UpdateTrainingRestrictionsDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdateTrainingRestrictionsDtoInput",
        "type": "object",
        "properties": {
          "restricted_to_channels": {
            "description": "Channels this instruction applies to. Pass [] to make it available on all channels.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SessionChannel"
            }
          },
          "restricted_to_segments": {
            "description": "Contact segment ids this instruction applies to. Pass [] to make it available to all contacts.",
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "ApplyTrainingDiffDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ApplyTrainingDiffDtoInput",
        "type": "object",
        "properties": {
          "diff_html": {
            "type": "string",
            "description": "Pre-rendered TipTap diff HTML"
          }
        },
        "required": [
          "diff_html"
        ]
      },
      "BatchDeleteOrgUsersDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/BatchDeleteOrgUsersDtoInput",
        "type": "object",
        "properties": {
          "user_ids": {
            "minItems": 1,
            "maxItems": 25,
            "type": "array",
            "items": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            },
            "description": "Organization user IDs to remove (duplicates are collapsed)"
          }
        },
        "required": [
          "user_ids"
        ]
      },
      "PublicApproveSuggestionDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/PublicApproveSuggestionDtoInput",
        "type": "object",
        "properties": {
          "categoryId": {
            "description": "Single suggested category to approve.",
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "categoryIds": {
            "description": "Suggested categories to approve in bulk (up to 100).",
            "minItems": 1,
            "maxItems": 100,
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            }
          }
        }
      },
      "PublicRejectSuggestionDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/PublicRejectSuggestionDtoInput",
        "type": "object",
        "properties": {
          "reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "categoryId": {
            "description": "Single suggested category to reject.",
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "categoryIds": {
            "description": "Suggested categories to reject in bulk (up to 100).",
            "minItems": 1,
            "maxItems": 100,
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            }
          },
          "fallbackCategoryId": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
            "description": "Category the rejected insights reassign to (shared across the batch)."
          }
        },
        "required": [
          "fallbackCategoryId"
        ]
      },
      "UpdatePublicVocSettingsDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdatePublicVocSettingsDtoInput",
        "type": "object",
        "properties": {
          "custom_analysis_instructions": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 1000
              },
              {
                "type": "null"
              }
            ],
            "description": "Full replacement for AI Instructions (≤1000 chars), or null to clear. Applies to future analyses only — existing insights are not re-run."
          }
        },
        "additionalProperties": false
      },
      "AssignInsightDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/AssignInsightDtoInput",
        "type": "object",
        "properties": {
          "groupId": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          }
        },
        "required": [
          "groupId"
        ]
      },
      "SendTemplateInputDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SendTemplateInputDtoInput",
        "type": "object",
        "properties": {
          "template_id": {
            "type": "string"
          },
          "phone_number_id": {
            "type": "string"
          },
          "variables": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "contact": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  }
                },
                "required": [
                  "id"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email",
                    "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                  }
                },
                "required": [
                  "email"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "phone_number": {
                    "type": "string"
                  }
                },
                "required": [
                  "phone_number"
                ]
              }
            ]
          },
          "session_id": {
            "type": "string"
          }
        },
        "required": [
          "template_id",
          "phone_number_id",
          "variables",
          "contact"
        ]
      },
      "CreatePublicArticleDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CreatePublicArticleDtoInput",
        "type": "object",
        "properties": {
          "category_entity_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "title": {
            "type": "string",
            "minLength": 1
          },
          "slug": {
            "type": "string"
          },
          "content_html": {
            "description": "Article body as an HTML fragment. Embed a video with `<div data-embed=\"youtube\" data-embed-id=\"VIDEO_ID\"></div>`, where `data-embed` is `youtube`, `vimeo`, `loom` or `wistia`; iframes are removed.",
            "type": "string"
          },
          "meta_title": {
            "type": "string"
          },
          "meta_description": {
            "type": "string"
          },
          "language_code": {
            "description": "Language the article is written in; defaults to the help center’s primary language. Must be one of the help center’s languages.",
            "type": "string"
          }
        },
        "required": [
          "category_entity_id",
          "title"
        ],
        "additionalProperties": false
      },
      "RunReportQueryBody": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/RunReportQueryBodyInput",
        "type": "object",
        "properties": {
          "sql": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100000
          },
          "parameters": {
            "default": [],
            "type": "array",
            "items": {}
          }
        },
        "required": [
          "sql"
        ]
      },
      "SalesforceMiawWebhookBody": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SalesforceMiawWebhookBodyInput",
        "type": "object",
        "properties": {
          "event": {
            "type": "string",
            "enum": [
              "message:new"
            ]
          },
          "session_id": {
            "type": "string"
          }
        },
        "required": [
          "event",
          "session_id"
        ]
      },
      "SetCoworkerTodosDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SetCoworkerTodosDtoInput",
        "type": "object",
        "properties": {
          "items": {
            "minItems": 1,
            "maxItems": 50,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "label": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 500
                }
              },
              "required": [
                "label"
              ]
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "UpdateCoworkerTodoDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdateCoworkerTodoDtoInput",
        "type": "object",
        "properties": {
          "index": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "in_progress",
              "completed"
            ]
          }
        },
        "required": [
          "index",
          "status"
        ]
      },
      "CoworkerNotifyTeamInput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CoworkerNotifyTeamInputInput",
        "type": "object",
        "properties": {
          "summary": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2000,
            "description": "Summary of what the user needs help with"
          },
          "context": {
            "description": "Additional context about the situation",
            "type": "string",
            "maxLength": 4000
          }
        },
        "required": [
          "summary"
        ]
      },
      "FinishSessionWrapUpBodyDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/FinishSessionWrapUpBodyDtoInput",
        "type": "object",
        "properties": {
          "session_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          }
        },
        "required": [
          "session_id"
        ]
      },
      "SetChatSessionSubStatusInput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SetChatSessionSubStatusInputInput",
        "type": "object",
        "properties": {
          "sub_status_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
            "description": "Id of the custom status to apply, from GET /custom-statuses"
          }
        },
        "required": [
          "sub_status_id"
        ]
      },
      "InvestigateSessionDebugInput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/InvestigateSessionDebugInputInput",
        "type": "object",
        "properties": {
          "session_id": {
            "description": "Customer support / inbox session UUID (from chat_sessions table). NOT the coworker chat session ID.",
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "ticket_number": {
            "description": "Ticket number to resolve to a session",
            "type": "string"
          },
          "date_from": {
            "description": "ISO 8601 start date for recent-window search (e.g. 2026-03-20T00:00:00Z)",
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          },
          "date_to": {
            "description": "ISO 8601 end date for recent-window search (e.g. 2026-03-25T23:59:59Z)",
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          },
          "channel_type": {
            "description": "Filter by channel (web, whatsapp, email, slack, etc.)",
            "type": "string"
          },
          "contact_name": {
            "description": "Filter by contact name (partial match)",
            "type": "string"
          },
          "contact_email": {
            "description": "Filter by contact email (partial match)",
            "type": "string"
          },
          "keyword": {
            "description": "Search keyword to match against message text",
            "type": "string"
          },
          "history_limit": {
            "description": "Max chat-history messages to return (default 30, min 10, max 30). Oldest-first.",
            "type": "integer",
            "minimum": 10,
            "maximum": 30
          }
        }
      },
      "BlockContactInputDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/BlockContactInputDtoInput",
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "format": "email",
            "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
            "description": "The email of the contact to block"
          },
          "reason": {
            "description": "Why the contact is being blocked",
            "type": "string"
          }
        },
        "required": [
          "email"
        ]
      },
      "BlockDomainsInputDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/BlockDomainsInputDtoInput",
        "type": "object",
        "properties": {
          "domains": {
            "type": "string",
            "minLength": 1,
            "description": "Domain(s) to block — comma-separated for multiple (e.g. \"spam.com, junk.org\")"
          },
          "reason": {
            "description": "Why these domains are being blocked",
            "type": "string"
          }
        },
        "required": [
          "domains"
        ]
      },
      "BlockIpsInputDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/BlockIpsInputDtoInput",
        "type": "object",
        "properties": {
          "ips": {
            "type": "string",
            "minLength": 1,
            "description": "IP(s) or CIDR range(s) to block — comma-separated for multiple (e.g. \"203.0.113.7, 198.51.100.0/24\")"
          },
          "reason": {
            "description": "Why these addresses are being blocked",
            "type": "string"
          },
          "expires_in_hours": {
            "description": "Lift the block automatically after this many hours (max 8760). Omit for a permanent block. Automated callers should always set this: a shared or carrier-grade NAT address fronts many people, and a permanent block on one bans all of them.",
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 8760
          }
        },
        "required": [
          "ips"
        ]
      },
      "AddToOutboundBlocklistDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/AddToOutboundBlocklistDtoInput",
        "type": "object",
        "properties": {
          "identity_type": {
            "type": "string",
            "enum": [
              "phone",
              "email",
              "whatsapp_user_id"
            ],
            "description": "What kind of address this is. \"phone\" is stored in international format, \"email\" is lowercased, and \"whatsapp_user_id\" is the WhatsApp id of a contact whose phone number is hidden."
          },
          "identity_value": {
            "type": "string",
            "minLength": 1,
            "maxLength": 320,
            "description": "The address itself — e.g. \"+962790007001\" or \"lead@example.com\"."
          },
          "reason": {
            "description": "Why this address is being blocked. Stored for your own auditing.",
            "type": "string",
            "maxLength": 500
          },
          "expires_at": {
            "description": "When the block should lift automatically, as an ISO 8601 timestamp. Must be in the future. Omit for a permanent block.",
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "identity_type",
          "identity_value"
        ]
      },
      "CreateEmailTemplatePublicInput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CreateEmailTemplatePublicInputInput",
        "$ref": "#/components/schemas/CreateEmailTemplateBodyDto"
      },
      "UpdateEmailTemplatePublicInput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdateEmailTemplatePublicInputInput",
        "$ref": "#/components/schemas/CreateEmailTemplateBodyDto"
      },
      "CreateMacroInput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CreateMacroInputInput",
        "type": "object",
        "properties": {
          "category": {
            "type": "string",
            "description": "Group the macro belongs to: a section in Settings → Macros and in the inbox macro picker. \"general\" when it has none."
          },
          "title": {
            "type": "string"
          },
          "content": {
            "type": "string",
            "maxLength": 20000,
            "description": "Macro body as HTML, limited to what every channel can carry: <p>, <br>, <strong>, <em>, <s>, <a href>, <ul>/<ol start>/<li> and inline images as `<img src=\"…\">` pointing at a file uploaded for this organization. Other markup is dropped (its text is kept); escape literal < and & as HTML entities, and use <br> or <p> for line breaks. Reference variables with {{variable}} syntax."
          },
          "options": {
            "description": "Up to 3 options the customer can tap instead of typing, sent with the macro on channels that show them. Each `label` is up to 20 characters. `type` is `text` (the tap reaches the session as the customer's reply) or `workflow` (the tap runs the macro's Macro Option Clicked workflows and the AI doesn't reply). This is the full list: on update, pass an existing option's `id` to keep it (workflows branching on that id keep working); options left out are removed, `[]` removes all, and omitting the field leaves them untouched. A macro with options needs body text.",
            "maxItems": 3,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MacroOptionInputDto"
            }
          },
          "exclude_from_suggestions": {
            "description": "When true, this macro is never suggested to agents. They can still search for it and use it. Defaults to false.",
            "type": "boolean"
          },
          "allowed_team_ids": {
            "description": "Teams whose agents see this macro in the inbox. Empty = every agent. Admins with Macros settings access always see it. Org-wide macros only. Defaults to every agent.",
            "maxItems": 50,
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "category",
          "title",
          "content"
        ]
      },
      "UpdateMacroInput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdateMacroInputInput",
        "type": "object",
        "properties": {
          "category": {
            "description": "Group the macro belongs to: a section in Settings → Macros and in the inbox macro picker. \"general\" when it has none.",
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "content": {
            "type": "string",
            "maxLength": 20000,
            "description": "Macro body as HTML, limited to what every channel can carry: <p>, <br>, <strong>, <em>, <s>, <a href>, <ul>/<ol start>/<li> and inline images as `<img src=\"…\">` pointing at a file uploaded for this organization. Other markup is dropped (its text is kept); escape literal < and & as HTML entities, and use <br> or <p> for line breaks. Reference variables with {{variable}} syntax."
          },
          "options": {
            "description": "Up to 3 options the customer can tap instead of typing, sent with the macro on channels that show them. Each `label` is up to 20 characters. `type` is `text` (the tap reaches the session as the customer's reply) or `workflow` (the tap runs the macro's Macro Option Clicked workflows and the AI doesn't reply). This is the full list: on update, pass an existing option's `id` to keep it (workflows branching on that id keep working); options left out are removed, `[]` removes all, and omitting the field leaves them untouched. A macro with options needs body text.",
            "maxItems": 3,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MacroOptionInputDto"
            }
          },
          "exclude_from_suggestions": {
            "description": "When true, this macro is never suggested to agents. They can still search for it and use it.",
            "type": "boolean"
          },
          "allowed_team_ids": {
            "description": "Teams whose agents see this macro in the inbox. Empty = every agent. Admins with Macros settings access always see it. Org-wide macros only.",
            "maxItems": 50,
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "UpsertTagInputDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpsertTagInputDtoInput",
        "type": "object",
        "properties": {
          "tag_name": {
            "type": "string",
            "minLength": 1,
            "description": "Tag name (e.g. \"billing\", \"refund\", \"feature-request\")"
          },
          "description": {
            "description": "Short description of what this tag means (max 160 chars)",
            "anyOf": [
              {
                "type": "string",
                "maxLength": 160
              },
              {
                "type": "null"
              }
            ]
          },
          "exclude_from_auto_tagging": {
            "description": "If true, the AI will never auto-apply this tag (default: false)",
            "type": "boolean"
          },
          "category_id": {
            "description": "Assign the tag to a category (uuid), null to clear, omit to leave unchanged",
            "anyOf": [
              {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "tag_name"
        ]
      },
      "UpdateAutoTaggingInputDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdateAutoTaggingInputDtoInput",
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean",
            "description": "Set true to enable, false to disable"
          }
        },
        "required": [
          "enabled"
        ]
      },
      "CreateTagCategoryInputDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CreateTagCategoryInputDtoInput",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "description": "Category name (e.g. \"Billing\", \"Product Area\")"
          },
          "description": {
            "type": "string",
            "minLength": 1,
            "description": "What this category groups together (used to guide AI tagging)"
          }
        },
        "required": [
          "name",
          "description"
        ]
      },
      "UpdateTagCategoryInputDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdateTagCategoryInputDtoInput",
        "type": "object",
        "properties": {
          "name": {
            "description": "New category name",
            "type": "string",
            "minLength": 1
          },
          "description": {
            "description": "New description for the category",
            "type": "string",
            "minLength": 1
          }
        }
      },
      "InvokeWorkflowDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/InvokeWorkflowDtoInput",
        "type": "object",
        "properties": {
          "input": {
            "default": {},
            "description": "Inputs for the workflow (ai payload / form data)",
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "context": {
            "type": "object",
            "properties": {
              "sessionId": {
                "description": "Conversation session for ticket context",
                "type": "string"
              }
            }
          }
        }
      },
      "SearchTrainingKnowledgeInputDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SearchTrainingKnowledgeInputDtoInput",
        "type": "object",
        "properties": {
          "query": {
            "type": "string",
            "minLength": 2,
            "maxLength": 500
          },
          "limit": {
            "default": 10,
            "type": "number",
            "minimum": 1,
            "maximum": 50
          },
          "visibility": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "internal",
                "public"
              ]
            }
          },
          "sourceTypes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "custom_training",
                "help_center",
                "integration",
                "website",
                "workflow"
              ]
            }
          },
          "dataSources": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "confluence",
                "notion",
                "zendesk_support",
                "shopify",
                "gitbook",
                "intercom",
                "front",
                "freshdesk",
                "hubspot_kb",
                "ai_instructions",
                "custom_training",
                "website",
                "workflow",
                "help_center"
              ]
            }
          },
          "sortBy": {
            "default": "relevance",
            "type": "string",
            "enum": [
              "relevance",
              "handoffs",
              "citations"
            ]
          },
          "dateFrom": {},
          "dateTo": {},
          "include_content": {
            "default": true,
            "description": "Include the full content field in results. Set to false to reduce response size.",
            "type": "boolean"
          }
        },
        "required": [
          "query"
        ]
      },
      "CreateTrainingDirectoryInputDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CreateTrainingDirectoryInputDtoInput",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "The directory name"
          },
          "parent_id": {
            "description": "Parent directory id. Omit or null for a top-level directory.",
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "name"
        ]
      },
      "UpdateTrainingDirectoryInputDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdateTrainingDirectoryInputDtoInput",
        "type": "object",
        "properties": {
          "name": {
            "description": "The new directory name",
            "type": "string"
          },
          "parent_id": {
            "description": "New parent directory id, or null for top level. Omit to keep the current parent.",
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "UpdateAiProfileInput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdateAiProfileInputInput",
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "prompt_message": {
            "type": "string"
          },
          "guard_rails_instructions": {
            "type": "string"
          },
          "language": {
            "type": "string"
          },
          "mode": {
            "default": "direct",
            "type": "string",
            "enum": [
              "direct",
              "diff"
            ]
          },
          "diff_html": {
            "type": "string"
          }
        }
      },
      "RevertTrainingVersionInputDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/RevertTrainingVersionInputDtoInput",
        "type": "object",
        "properties": {}
      },
      "ToggleDraftInputDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ToggleDraftInputDtoInput",
        "type": "object",
        "properties": {
          "draft": {
            "type": "boolean",
            "description": "Set true for draft (inactive), false to publish (active)"
          }
        },
        "required": [
          "draft"
        ]
      },
      "PublishTrainingInputDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/PublishTrainingInputDtoInput",
        "type": "object",
        "properties": {}
      },
      "MoveTrainingInputDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/MoveTrainingInputDtoInput",
        "type": "object",
        "properties": {
          "directory_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Target directory ID, or null to uncategorize"
          }
        },
        "required": [
          "directory_id"
        ]
      },
      "UpdateTrainingMetadataDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdateTrainingMetadataDtoInput",
        "type": "object",
        "properties": {
          "metadata": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {},
            "description": "Key-value pairs to merge into existing metadata"
          }
        },
        "required": [
          "metadata"
        ]
      },
      "InviteUserPublicDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/InviteUserPublicDtoInput",
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "format": "email",
            "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
          }
        },
        "required": [
          "email"
        ]
      },
      "SimulatePhoneRingInput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SimulatePhoneRingInputInput",
        "type": "object",
        "properties": {
          "sessionId": {
            "type": "string"
          },
          "phoneAgentId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "agentName": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "fromPhoneNumber": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "reason": {
            "$ref": "#/components/schemas/PhoneHandoffReason"
          }
        },
        "required": [
          "sessionId"
        ]
      },
      "AuditLogApiKeyActorDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/AuditLogApiKeyActorDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "created_by_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "created_by_email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "name",
          "created_by_name",
          "created_by_email"
        ],
        "additionalProperties": false
      },
      "MergeSessionsResult": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/MergeSessionsResult",
        "type": "object",
        "properties": {
          "mergeId": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "primarySessionId": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "ticket_number": {
                  "type": "number"
                },
                "main_status": {
                  "type": "string",
                  "enum": [
                    "closed_resolved",
                    "closed_unresolved",
                    "open"
                  ]
                }
              },
              "required": [
                "id",
                "ticket_number",
                "main_status"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "mergeId",
          "primarySessionId",
          "sources"
        ],
        "additionalProperties": false
      },
      "ChatAttachmentDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ChatAttachmentDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "size": {
            "type": "number"
          },
          "type": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "openai_file_id": {
            "type": "string"
          },
          "email_inline": {
            "type": "boolean"
          },
          "content_id": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": [
          "id",
          "name",
          "size",
          "type",
          "url"
        ],
        "additionalProperties": false
      },
      "WhatsAppTemplateDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/WhatsAppTemplateDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "APPROVED",
              "REJECTED",
              "PENDING",
              "PAUSED",
              "DISABLED",
              "IN_APPEAL",
              "PENDING_DELETION",
              "DELETED",
              "LIMIT_EXCEEDED",
              "ARCHIVED"
            ]
          },
          "category": {
            "type": "string",
            "enum": [
              "UTILITY",
              "MARKETING",
              "AUTHENTICATION"
            ]
          },
          "parameter_format": {
            "type": "string",
            "enum": [
              "NAMED",
              "POSITIONAL"
            ]
          },
          "language": {
            "type": "string"
          },
          "components": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "HEADER"
                        },
                        "format": {
                          "type": "string",
                          "const": "TEXT"
                        },
                        "text": {
                          "type": "string",
                          "description": "60 chars max"
                        },
                        "example": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "header_text": {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                }
                              },
                              "required": [
                                "header_text"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "header_text_named_params": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "param_name": {
                                        "type": "string"
                                      },
                                      "example": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "param_name",
                                      "example"
                                    ],
                                    "additionalProperties": false
                                  }
                                }
                              },
                              "required": [
                                "header_text_named_params"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "required": [
                        "type",
                        "format",
                        "text"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "HEADER"
                        },
                        "format": {
                          "type": "string",
                          "enum": [
                            "IMAGE",
                            "DOCUMENT",
                            "VIDEO"
                          ],
                          "description": "\n  /**\n   * IMAGE: JPG | PNG\n   * DOCUMENT: PDF\n   * VIDEO: MP4\n   */\n    "
                        },
                        "example": {
                          "type": "object",
                          "properties": {
                            "header_handle": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                }
                              ],
                              "description": "\n    /**\n     * A handle for the media uploaded through the Resumable Upload API\n     * https://developers.facebook.com/docs/graph-api/guides/upload\n     */\n    "
                            }
                          },
                          "required": [
                            "header_handle"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "type",
                        "format"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "HEADER"
                        },
                        "format": {
                          "type": "string",
                          "const": "LOCATION"
                        }
                      },
                      "required": [
                        "type",
                        "format"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "BODY"
                        },
                        "text": {
                          "type": "string",
                          "description": "1024 chars max, or 32768 if `body` is the only component in the template"
                        },
                        "example": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "body_text": {
                                  "type": "array",
                                  "items": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  },
                                  "description": "Yes, this is an array of arrays, but only the first array is used, just like `header_text`"
                                }
                              },
                              "required": [
                                "body_text"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "body_text_named_params": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "param_name": {
                                        "type": "string"
                                      },
                                      "example": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "param_name",
                                      "example"
                                    ],
                                    "additionalProperties": false
                                  }
                                }
                              },
                              "required": [
                                "body_text_named_params"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "required": [
                        "type",
                        "text"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "FOOTER"
                        },
                        "text": {
                          "type": "string",
                          "description": "60 chars max"
                        }
                      },
                      "required": [
                        "type",
                        "text"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "BUTTONS",
                          "description": "\n  /**\n   * Templates are limited to 10 quick reply buttons. If using quick reply buttons with other buttons,\n   * buttons must be organized into two groups: quick reply buttons and non-quick reply buttons.\n   * If grouped incorrectly, the API will return an error indicating an invalid combination.\n   *\n   * Examples of valid groupings:\n   * - Quick Reply, Quick Reply\n   * - Quick Reply, Quick Reply, URL, Phone\n   * - URL, Phone, Quick Reply, Quick Reply\n   *\n   * Examples of invalid groupings:\n   * - Quick Reply, URL, Quick Reply\n   * - URL, Quick Reply, URL\n   */\n  "
                        },
                        "buttons": {
                          "type": "array",
                          "items": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "QUICK_REPLY"
                                  },
                                  "text": {
                                    "type": "string",
                                    "description": "25 chars max"
                                  }
                                },
                                "required": [
                                  "type",
                                  "text"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "URL"
                                  },
                                  "text": {
                                    "type": "string"
                                  },
                                  "url": {
                                    "type": "string",
                                    "description": "2000 chars max"
                                  },
                                  "example": {
                                    "type": "array",
                                    "prefixItems": [
                                      {
                                        "type": "string",
                                        "description": "2000 chars max"
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "type",
                                  "text",
                                  "url"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "PHONE_NUMBER"
                                  },
                                  "text": {
                                    "type": "string",
                                    "description": "25 chars max"
                                  },
                                  "phone_number": {
                                    "type": "string",
                                    "description": "20 chars max"
                                  }
                                },
                                "required": [
                                  "type",
                                  "text",
                                  "phone_number"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "COPY_CODE"
                                  },
                                  "example": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "array",
                                        "items": {
                                          "type": "string"
                                        }
                                      }
                                    ],
                                    "description": "15 chars max"
                                  }
                                },
                                "required": [
                                  "type",
                                  "example"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "FLOW"
                                  },
                                  "text": {
                                    "type": "string",
                                    "description": "25 chars max"
                                  },
                                  "icon": {
                                    "type": "string",
                                    "enum": [
                                      "DOCUMENT",
                                      "PROMOTION",
                                      "REVIEW"
                                    ]
                                  },
                                  "flow_id": {
                                    "type": "string"
                                  },
                                  "flow_name": {
                                    "type": "string"
                                  },
                                  "flow_json": {
                                    "type": "object",
                                    "propertyNames": {
                                      "type": "string"
                                    },
                                    "additionalProperties": {}
                                  },
                                  "flow_action": {
                                    "type": "string",
                                    "enum": [
                                      "data_exchange",
                                      "navigate"
                                    ]
                                  },
                                  "navigate_screen": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "type",
                                  "text",
                                  "icon",
                                  "flow_action"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "MPM"
                                  },
                                  "example": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "type",
                                  "example"
                                ],
                                "additionalProperties": false
                              }
                            ]
                          }
                        }
                      },
                      "required": [
                        "type",
                        "buttons"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "rejected_reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "message_send_ttl_seconds": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "name",
          "status",
          "category",
          "parameter_format",
          "language"
        ],
        "additionalProperties": false
      },
      "PhoneCallEventDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/PhoneCallEventDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "phone_call_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "event_type": {
            "type": "string",
            "enum": [
              "answer_detected",
              "ring_started",
              "ring_accepted",
              "ring_declined",
              "ring_missed",
              "dial_started",
              "customer_answered",
              "human_joined",
              "transfer_initiated",
              "transfer_accepted",
              "transfer_completed",
              "transfer_cancelled",
              "transfer_declined",
              "participant_invited",
              "participant_joined",
              "participant_left",
              "participant_removed",
              "participant_declined",
              "call_ended",
              "call_failed"
            ]
          },
          "actor_user_id": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "actor_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "detail": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "phone_call_id",
          "event_type",
          "actor_user_id",
          "actor_name",
          "detail",
          "created_at"
        ],
        "additionalProperties": false
      },
      "PhoneCallDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/PhoneCallDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "session_id": {
            "type": "string"
          },
          "direction": {
            "type": "string",
            "enum": [
              "inbound",
              "outbound"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "initiating",
              "ringing",
              "in_progress",
              "completed",
              "no_answer",
              "busy",
              "rejected",
              "failed",
              "missed",
              "canceled"
            ]
          },
          "disposition": {
            "type": "string",
            "enum": [
              "human_answered",
              "no_answer",
              "busy",
              "declined",
              "voicemail",
              "failed",
              "canceled",
              "unknown"
            ]
          },
          "initiated_by_user_id": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "phone_agent_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "from_number": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "to_number": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "failure_reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "livekit_disconnect_reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "ring_started_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "ring_expires_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "accepted_by_user_id": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "answered_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "ended_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "ended_by_user_id": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "duration_seconds": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "ring_duration_seconds": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "recording_status": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "pending",
                  "completed",
                  "failed"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "has_recording": {
            "type": "boolean"
          },
          "recording_disabled": {
            "type": "boolean"
          },
          "has_voicemail": {
            "type": "boolean"
          },
          "is_session_latest_call": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PhoneCallEventDto"
            }
          }
        },
        "required": [
          "id",
          "session_id",
          "direction",
          "status",
          "initiated_by_user_id",
          "phone_agent_id",
          "from_number",
          "to_number",
          "failure_reason",
          "livekit_disconnect_reason",
          "ring_started_at",
          "ring_expires_at",
          "accepted_by_user_id",
          "answered_at",
          "ended_at",
          "ended_by_user_id",
          "duration_seconds",
          "ring_duration_seconds",
          "recording_status",
          "has_recording",
          "is_session_latest_call",
          "created_at",
          "events"
        ],
        "additionalProperties": false
      },
      "MessageOptionDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/MessageOptionDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "type": {
            "$ref": "#/components/schemas/MessageOptionType"
          }
        },
        "required": [
          "id",
          "label",
          "type"
        ],
        "additionalProperties": false
      },
      "MessageOptionsSourceDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/MessageOptionsSourceDto",
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "macro"
              },
              "macro_id": {
                "type": "string"
              },
              "macro_title": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "macro_id",
              "macro_title"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "workflow"
              },
              "workflow_id": {
                "type": "string"
              },
              "workflow_run_id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "workflow_id",
              "workflow_run_id"
            ],
            "additionalProperties": false
          }
        ]
      },
      "MessageOptionsDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/MessageOptionsDto",
        "type": "object",
        "properties": {
          "source": {
            "$ref": "#/components/schemas/MessageOptionsSourceDto"
          },
          "options": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MessageOptionDto"
            }
          },
          "picked_option_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "picked_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "picked_message_uuid": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "source",
          "options",
          "picked_option_id",
          "picked_at",
          "picked_message_uuid"
        ],
        "additionalProperties": false
      },
      "AgentChangedPayload": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/AgentChangedPayload",
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "from": {
                "type": "string",
                "const": "ai"
              },
              "to": {
                "type": "string",
                "const": "human_agent"
              },
              "agent_id": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "from",
              "to",
              "agent_id"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "from": {
                "type": "string",
                "const": "human_agent"
              },
              "to": {
                "type": "string",
                "const": "ai"
              },
              "agent_id": {
                "type": "number"
              }
            },
            "required": [
              "from",
              "to",
              "agent_id"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "from": {
                "type": "string",
                "const": "human_agent"
              },
              "to": {
                "type": "string",
                "const": "human_agent"
              },
              "agent_id": {
                "type": "number"
              },
              "old_agent_id": {
                "type": "number"
              }
            },
            "required": [
              "from",
              "to",
              "agent_id",
              "old_agent_id"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "from": {
                "type": "string",
                "const": "human_agent"
              },
              "to": {
                "type": "string",
                "const": "unassigned"
              }
            },
            "required": [
              "from",
              "to"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "from": {
                "type": "string",
                "const": "ai"
              },
              "to": {
                "type": "string",
                "const": "unassigned"
              }
            },
            "required": [
              "from",
              "to"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "from": {
                "type": "string",
                "const": "unassigned"
              },
              "to": {
                "type": "string",
                "const": "human_agent"
              },
              "agent_id": {
                "type": "number"
              }
            },
            "required": [
              "from",
              "to",
              "agent_id"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "from": {
                "type": "string",
                "const": "unassigned"
              },
              "to": {
                "type": "string",
                "const": "ai"
              }
            },
            "required": [
              "from",
              "to"
            ],
            "additionalProperties": false
          }
        ]
      },
      "ChatHistoryDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ChatHistoryDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "number"
          },
          "uuid": {
            "type": "string"
          },
          "chatbot_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "session_id": {
            "type": "string"
          },
          "from_user": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ]
          },
          "message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "original_message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "original_language": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "translated_message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "translated_language": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "updated_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "debug_json": {
            "anyOf": [
              {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "v2": {
                        "type": "object",
                        "properties": {
                          "response": {
                            "allOf": [
                              {
                                "oneOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "type": {
                                        "type": "string",
                                        "const": "prohibited_topic"
                                      },
                                      "topic": {
                                        "type": "string"
                                      },
                                      "decisionEvidence": {
                                        "type": "array",
                                        "items": {
                                          "oneOf": [
                                            {
                                              "type": "object",
                                              "properties": {
                                                "origin": {
                                                  "type": "string",
                                                  "const": "prohibited_topic_precheck"
                                                },
                                                "decision": {
                                                  "type": "string",
                                                  "const": "stop_response"
                                                },
                                                "topic": {
                                                  "type": "object",
                                                  "properties": {
                                                    "id": {
                                                      "anyOf": [
                                                        {
                                                          "type": "string"
                                                        },
                                                        {
                                                          "type": "null"
                                                        }
                                                      ]
                                                    },
                                                    "index": {
                                                      "type": "integer",
                                                      "minimum": 0,
                                                      "maximum": 9007199254740991
                                                    },
                                                    "name": {
                                                      "type": "string"
                                                    },
                                                    "description": {
                                                      "anyOf": [
                                                        {
                                                          "type": "string"
                                                        },
                                                        {
                                                          "type": "null"
                                                        }
                                                      ]
                                                    }
                                                  },
                                                  "required": [
                                                    "id",
                                                    "index",
                                                    "name",
                                                    "description"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                "behavior": {
                                                  "type": "string",
                                                  "enum": [
                                                    "always_handoff",
                                                    "never_handoff",
                                                    "handoff_within_hours_only"
                                                  ]
                                                },
                                                "handoff": {
                                                  "type": "string",
                                                  "enum": [
                                                    "callback_completed",
                                                    "callback_unavailable",
                                                    "suppressed"
                                                  ]
                                                },
                                                "within_office_hours": {
                                                  "anyOf": [
                                                    {
                                                      "type": "boolean"
                                                    },
                                                    {
                                                      "type": "null"
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "origin",
                                                "decision",
                                                "topic",
                                                "behavior",
                                                "handoff",
                                                "within_office_hours"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "origin": {
                                                  "type": "string",
                                                  "enum": [
                                                    "handoff_tool",
                                                    "reply_handoff_guard"
                                                  ]
                                                },
                                                "decision": {
                                                  "type": "string",
                                                  "const": "handoff"
                                                },
                                                "outcome": {
                                                  "type": "string",
                                                  "enum": [
                                                    "callback_completed",
                                                    "callback_failed"
                                                  ]
                                                },
                                                "explanation": {
                                                  "type": "string"
                                                },
                                                "sources": {
                                                  "type": "array",
                                                  "items": {
                                                    "type": "object",
                                                    "properties": {
                                                      "ref_id": {
                                                        "type": "string"
                                                      },
                                                      "type": {
                                                        "type": "string",
                                                        "enum": [
                                                          "knowledge",
                                                          "instruction"
                                                        ]
                                                      },
                                                      "id": {
                                                        "type": "string"
                                                      },
                                                      "title": {
                                                        "type": "string"
                                                      },
                                                      "chunk_index": {
                                                        "type": "integer",
                                                        "minimum": 0,
                                                        "maximum": 9007199254740991
                                                      },
                                                      "source_format": {
                                                        "type": "string",
                                                        "enum": [
                                                          "html",
                                                          "knowledge",
                                                          "text"
                                                        ]
                                                      }
                                                    },
                                                    "required": [
                                                      "ref_id",
                                                      "type",
                                                      "id",
                                                      "title"
                                                    ],
                                                    "additionalProperties": false
                                                  }
                                                }
                                              },
                                              "required": [
                                                "origin",
                                                "decision",
                                                "outcome",
                                                "explanation",
                                                "sources"
                                              ],
                                              "additionalProperties": false
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "topic"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "type": {
                                        "type": "string",
                                        "const": "response_skipped"
                                      },
                                      "reason": {
                                        "type": "string",
                                        "enum": [
                                          "empty_response",
                                          "potential_answers_dead_end",
                                          "silent_handoff",
                                          "assist_human_handling_recommended",
                                          "superseded_by_newer_run",
                                          "interrupted",
                                          "answered_in_narration",
                                          "steered_into_live_turn",
                                          "session_busy",
                                          "flagged_as_spam",
                                          "awaiting_option_tap"
                                        ]
                                      },
                                      "reasoning": {
                                        "type": "array",
                                        "items": {
                                          "oneOf": [
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "const": "reasoning"
                                                },
                                                "content": {
                                                  "type": "string"
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "content"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "const": "tool_call"
                                                },
                                                "call_id": {
                                                  "type": "string"
                                                },
                                                "tool_name": {
                                                  "type": "string"
                                                },
                                                "action": {
                                                  "type": "object",
                                                  "properties": {
                                                    "name": {
                                                      "type": "string"
                                                    },
                                                    "id": {
                                                      "type": "string"
                                                    },
                                                    "openapi": {
                                                      "type": "object",
                                                      "properties": {
                                                        "openapi_spec_id": {
                                                          "type": "string"
                                                        },
                                                        "operation_spec": {},
                                                        "operation_id": {
                                                          "type": "string"
                                                        },
                                                        "operation_method": {
                                                          "type": "string"
                                                        }
                                                      },
                                                      "required": [
                                                        "operation_spec"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    "metadata": {},
                                                    "required_form_submission": {
                                                      "type": "boolean"
                                                    },
                                                    "is_handoff_like": {
                                                      "type": "boolean"
                                                    }
                                                  },
                                                  "required": [
                                                    "name",
                                                    "id",
                                                    "metadata"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                "call_arguments": {
                                                  "type": "string"
                                                },
                                                "call_result": {
                                                  "type": "string"
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "call_id",
                                                "tool_name",
                                                "call_arguments",
                                                "call_result"
                                              ],
                                              "additionalProperties": false
                                            }
                                          ]
                                        }
                                      },
                                      "context": {
                                        "type": "object",
                                        "properties": {
                                          "knowledgeBaseItems": {
                                            "type": "array",
                                            "items": {
                                              "type": "object",
                                              "properties": {
                                                "itemId": {
                                                  "type": "string"
                                                },
                                                "chunkIndex": {
                                                  "type": "number"
                                                },
                                                "title": {
                                                  "type": "string"
                                                },
                                                "url": {
                                                  "type": "string"
                                                }
                                              },
                                              "required": [
                                                "itemId",
                                                "chunkIndex",
                                                "title"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "instructions": {
                                            "type": "array",
                                            "items": {
                                              "type": "object",
                                              "properties": {
                                                "id": {
                                                  "type": "string"
                                                },
                                                "title": {
                                                  "type": "string"
                                                },
                                                "source": {
                                                  "type": "string",
                                                  "const": "sequence_campaign"
                                                }
                                              },
                                              "required": [
                                                "id",
                                                "title"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "tools": {
                                            "type": "array",
                                            "items": {
                                              "type": "object",
                                              "properties": {
                                                "name": {
                                                  "type": "string"
                                                }
                                              },
                                              "required": [
                                                "name"
                                              ],
                                              "additionalProperties": false
                                            }
                                          }
                                        },
                                        "required": [
                                          "knowledgeBaseItems",
                                          "instructions",
                                          "tools"
                                        ],
                                        "additionalProperties": false
                                      },
                                      "suppressedResponseText": {
                                        "type": "string"
                                      },
                                      "reasoningSummary": {
                                        "type": "string"
                                      },
                                      "structuredFieldLeaks": {
                                        "type": "array",
                                        "items": {
                                          "type": "object",
                                          "properties": {
                                            "attempt": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 9007199254740991
                                            },
                                            "field": {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "null"
                                                }
                                              ]
                                            },
                                            "marker": {
                                              "type": "string"
                                            },
                                            "retried": {
                                              "type": "boolean"
                                            }
                                          },
                                          "required": [
                                            "attempt",
                                            "field",
                                            "marker",
                                            "retried"
                                          ],
                                          "additionalProperties": false
                                        }
                                      }
                                    },
                                    "required": [
                                      "type"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "type": {
                                        "type": "string",
                                        "const": "response"
                                      },
                                      "responseText": {
                                        "type": "string"
                                      },
                                      "responseTextWithReferences": {
                                        "type": "string"
                                      },
                                      "context": {
                                        "type": "object",
                                        "properties": {
                                          "knowledgeBaseItems": {
                                            "type": "array",
                                            "items": {
                                              "type": "object",
                                              "properties": {
                                                "itemId": {
                                                  "type": "string"
                                                },
                                                "chunkIndex": {
                                                  "type": "number"
                                                },
                                                "title": {
                                                  "type": "string"
                                                },
                                                "url": {
                                                  "type": "string"
                                                }
                                              },
                                              "required": [
                                                "itemId",
                                                "chunkIndex",
                                                "title"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "instructions": {
                                            "type": "array",
                                            "items": {
                                              "type": "object",
                                              "properties": {
                                                "id": {
                                                  "type": "string"
                                                },
                                                "title": {
                                                  "type": "string"
                                                },
                                                "source": {
                                                  "type": "string",
                                                  "const": "sequence_campaign"
                                                }
                                              },
                                              "required": [
                                                "id",
                                                "title"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "tools": {
                                            "type": "array",
                                            "items": {
                                              "type": "object",
                                              "properties": {
                                                "name": {
                                                  "type": "string"
                                                }
                                              },
                                              "required": [
                                                "name"
                                              ],
                                              "additionalProperties": false
                                            }
                                          }
                                        },
                                        "required": [
                                          "knowledgeBaseItems",
                                          "instructions",
                                          "tools"
                                        ],
                                        "additionalProperties": false
                                      },
                                      "reasoning": {
                                        "type": "array",
                                        "items": {
                                          "oneOf": [
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "const": "reasoning"
                                                },
                                                "content": {
                                                  "type": "string"
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "content"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "const": "tool_call"
                                                },
                                                "call_id": {
                                                  "type": "string"
                                                },
                                                "tool_name": {
                                                  "type": "string"
                                                },
                                                "action": {
                                                  "type": "object",
                                                  "properties": {
                                                    "name": {
                                                      "type": "string"
                                                    },
                                                    "id": {
                                                      "type": "string"
                                                    },
                                                    "openapi": {
                                                      "type": "object",
                                                      "properties": {
                                                        "openapi_spec_id": {
                                                          "type": "string"
                                                        },
                                                        "operation_spec": {},
                                                        "operation_id": {
                                                          "type": "string"
                                                        },
                                                        "operation_method": {
                                                          "type": "string"
                                                        }
                                                      },
                                                      "required": [
                                                        "operation_spec"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    "metadata": {},
                                                    "required_form_submission": {
                                                      "type": "boolean"
                                                    },
                                                    "is_handoff_like": {
                                                      "type": "boolean"
                                                    }
                                                  },
                                                  "required": [
                                                    "name",
                                                    "id",
                                                    "metadata"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                "call_arguments": {
                                                  "type": "string"
                                                },
                                                "call_result": {
                                                  "type": "string"
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "call_id",
                                                "tool_name",
                                                "call_arguments",
                                                "call_result"
                                              ],
                                              "additionalProperties": false
                                            }
                                          ]
                                        }
                                      },
                                      "structuredFieldLeaks": {
                                        "type": "array",
                                        "items": {
                                          "type": "object",
                                          "properties": {
                                            "attempt": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 9007199254740991
                                            },
                                            "field": {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "null"
                                                }
                                              ]
                                            },
                                            "marker": {
                                              "type": "string"
                                            },
                                            "retried": {
                                              "type": "boolean"
                                            }
                                          },
                                          "required": [
                                            "attempt",
                                            "field",
                                            "marker",
                                            "retried"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "reasoningSummary": {
                                        "type": "string"
                                      },
                                      "quickReplySuggestions": {
                                        "type": "array",
                                        "items": {
                                          "type": "object",
                                          "properties": {
                                            "toolName": {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "null"
                                                }
                                              ]
                                            },
                                            "suggestions": {
                                              "type": "array",
                                              "items": {
                                                "type": "string"
                                              }
                                            }
                                          },
                                          "required": [
                                            "suggestions"
                                          ],
                                          "additionalProperties": false
                                        },
                                        "description": "Quick reply suggestions for the user"
                                      },
                                      "mightSolveUserIssue": {
                                        "type": "boolean",
                                        "description": "If your answer might solve the user's issue, return true, otherwise false. Note: once the user confirms it is solved, stop returning true"
                                      },
                                      "completelyAndFullyCoveredUserIssue": {
                                        "description": "True if your answer to the user completely covers the issue from knowledge and tools, and no further user input is needed. False if your answer is generic or is not specific to the issue.",
                                        "type": "boolean"
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "responseText",
                                      "responseTextWithReferences",
                                      "context",
                                      "reasoning",
                                      "quickReplySuggestions",
                                      "mightSolveUserIssue"
                                    ],
                                    "additionalProperties": false
                                  }
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "language": {
                                    "type": "string",
                                    "enum": [
                                      "en",
                                      "fr",
                                      "de",
                                      "nl",
                                      "pl",
                                      "pt",
                                      "es",
                                      "it",
                                      "ru",
                                      "ja",
                                      "ko",
                                      "zh",
                                      "ar",
                                      "tr",
                                      "sv",
                                      "da",
                                      "no",
                                      "fi",
                                      "el",
                                      "cs",
                                      "hu",
                                      "th",
                                      "vi",
                                      "id",
                                      "he",
                                      "hi",
                                      "uk",
                                      "ro",
                                      "bg",
                                      "hr",
                                      "sk",
                                      "sl",
                                      "sr",
                                      "et",
                                      "lv",
                                      "lt",
                                      "is",
                                      "ga",
                                      "ms",
                                      "tl",
                                      "fa",
                                      "bn",
                                      "ta",
                                      "te",
                                      "ur",
                                      "sw",
                                      "zu",
                                      "af",
                                      "sq",
                                      "hy",
                                      "az",
                                      "eu",
                                      "be",
                                      "bs",
                                      "ca",
                                      "cy",
                                      "ku",
                                      "ckb",
                                      "kmr"
                                    ]
                                  }
                                },
                                "required": [
                                  "language"
                                ],
                                "additionalProperties": false
                              }
                            ]
                          }
                        },
                        "required": [
                          "response"
                        ],
                        "additionalProperties": false
                      },
                      "actionCalls": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "callId": {
                              "type": "string"
                            },
                            "action": {
                              "type": "object",
                              "properties": {
                                "name": {
                                  "type": "string"
                                },
                                "id": {
                                  "type": "string"
                                },
                                "openapi": {
                                  "type": "object",
                                  "properties": {
                                    "openapi_spec_id": {
                                      "type": "string"
                                    },
                                    "operation_spec": {},
                                    "operation_id": {
                                      "type": "string"
                                    },
                                    "operation_method": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "operation_spec"
                                  ],
                                  "additionalProperties": false
                                },
                                "metadata": {},
                                "required_form_submission": {
                                  "type": "boolean"
                                },
                                "is_handoff_like": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "name",
                                "id",
                                "metadata"
                              ],
                              "additionalProperties": false
                            },
                            "arguments": {},
                            "result": {}
                          },
                          "required": [
                            "action",
                            "arguments",
                            "result"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "assignment_choice_summary": {
                        "default": null,
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "strategy": {
                                "type": "string",
                                "const": "least-busy"
                              },
                              "selected": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "agent_id": {
                                        "type": "number"
                                      },
                                      "agent_name": {
                                        "type": "string"
                                      },
                                      "active_sessions": {
                                        "type": "number"
                                      },
                                      "active_sessions_in_group": {
                                        "type": "number"
                                      },
                                      "pending_sessions": {
                                        "type": "number"
                                      },
                                      "remaining_capacity": {
                                        "type": "number"
                                      },
                                      "max_capacity": {
                                        "type": "number"
                                      },
                                      "max_capacity_in_group": {
                                        "anyOf": [
                                          {
                                            "type": "number"
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "is_available_globally": {
                                        "type": "boolean"
                                      },
                                      "is_available_in_group": {
                                        "type": "boolean"
                                      },
                                      "missing_required_skills": {
                                        "default": [],
                                        "type": "array",
                                        "items": {
                                          "type": "object",
                                          "properties": {
                                            "id": {
                                              "type": "string"
                                            },
                                            "name": {
                                              "type": "string"
                                            }
                                          },
                                          "required": [
                                            "id",
                                            "name"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "pacing_until": {
                                        "default": null,
                                        "anyOf": [
                                          {
                                            "type": "string"
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "skip_reason": {
                                        "default": null,
                                        "anyOf": [
                                          {
                                            "type": "string",
                                            "enum": [
                                              "pacing"
                                            ]
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      }
                                    },
                                    "required": [
                                      "agent_id",
                                      "agent_name",
                                      "active_sessions",
                                      "active_sessions_in_group",
                                      "pending_sessions",
                                      "remaining_capacity",
                                      "max_capacity",
                                      "max_capacity_in_group",
                                      "is_available_globally",
                                      "is_available_in_group",
                                      "missing_required_skills",
                                      "pacing_until",
                                      "skip_reason"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "peers": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "agent_id": {
                                      "type": "number"
                                    },
                                    "agent_name": {
                                      "type": "string"
                                    },
                                    "active_sessions": {
                                      "type": "number"
                                    },
                                    "active_sessions_in_group": {
                                      "type": "number"
                                    },
                                    "pending_sessions": {
                                      "type": "number"
                                    },
                                    "remaining_capacity": {
                                      "type": "number"
                                    },
                                    "max_capacity": {
                                      "type": "number"
                                    },
                                    "max_capacity_in_group": {
                                      "anyOf": [
                                        {
                                          "type": "number"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "is_available_globally": {
                                      "type": "boolean"
                                    },
                                    "is_available_in_group": {
                                      "type": "boolean"
                                    },
                                    "missing_required_skills": {
                                      "default": [],
                                      "type": "array",
                                      "items": {
                                        "type": "object",
                                        "properties": {
                                          "id": {
                                            "type": "string"
                                          },
                                          "name": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "id",
                                          "name"
                                        ],
                                        "additionalProperties": false
                                      }
                                    },
                                    "pacing_until": {
                                      "default": null,
                                      "anyOf": [
                                        {
                                          "type": "string"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "skip_reason": {
                                      "default": null,
                                      "anyOf": [
                                        {
                                          "type": "string",
                                          "enum": [
                                            "pacing"
                                          ]
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    }
                                  },
                                  "required": [
                                    "agent_id",
                                    "agent_name",
                                    "active_sessions",
                                    "active_sessions_in_group",
                                    "pending_sessions",
                                    "remaining_capacity",
                                    "max_capacity",
                                    "max_capacity_in_group",
                                    "is_available_globally",
                                    "is_available_in_group",
                                    "missing_required_skills",
                                    "pacing_until",
                                    "skip_reason"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "required_skills": {
                                "default": [],
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "id": {
                                      "type": "string"
                                    },
                                    "name": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "id",
                                    "name"
                                  ],
                                  "additionalProperties": false
                                }
                              }
                            },
                            "required": [
                              "strategy",
                              "selected",
                              "peers",
                              "required_skills"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "custom_data": {
                        "anyOf": [
                          {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {}
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "assist_mode": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "v2"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "actionCalls": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "callId": {
                              "type": "string"
                            },
                            "action": {
                              "type": "object",
                              "properties": {
                                "name": {
                                  "type": "string"
                                },
                                "id": {
                                  "type": "string"
                                },
                                "openapi": {
                                  "type": "object",
                                  "properties": {
                                    "openapi_spec_id": {
                                      "type": "string"
                                    },
                                    "operation_spec": {},
                                    "operation_id": {
                                      "type": "string"
                                    },
                                    "operation_method": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "operation_spec"
                                  ],
                                  "additionalProperties": false
                                },
                                "metadata": {},
                                "required_form_submission": {
                                  "type": "boolean"
                                },
                                "is_handoff_like": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "name",
                                "id",
                                "metadata"
                              ],
                              "additionalProperties": false
                            },
                            "arguments": {},
                            "result": {}
                          },
                          "required": [
                            "action",
                            "arguments",
                            "result"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "actionSearchQuery": {
                        "type": "string"
                      },
                      "knowledge": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "source": {
                              "type": "string"
                            },
                            "source_type": {
                              "type": "string"
                            },
                            "url": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "source",
                            "source_type",
                            "url"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "knowledge_used": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "content": {
                              "type": "string"
                            },
                            "source": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "content",
                            "source"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "work_instructions_scanned": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "content": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "content"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "client_context": {
                        "anyOf": [
                          {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {}
                          },
                          {
                            "type": "null"
                          }
                        ],
                        "description": "Context provided from the client. For example, dynamic metadata sent from the widget such as: the current product name on the page, the current Shopify shop domain, etc etc."
                      },
                      "additional_debug_data": {
                        "anyOf": [
                          {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {}
                          },
                          {
                            "type": "null"
                          }
                        ],
                        "description": "Org-specific or message-type-specific debug data."
                      },
                      "custom_data": {
                        "anyOf": [
                          {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {}
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "whatsapp_template_request": {
                        "anyOf": [
                          {},
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "assist_mode": {
                        "type": "boolean"
                      },
                      "whatsapp_template_snapshot": {
                        "anyOf": [
                          {},
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "message_options": {
                        "anyOf": [
                          {},
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "rule_violation_reflections": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "rule_name": {
                              "type": "string"
                            },
                            "violation_description": {
                              "type": "string",
                              "description": "How the rule was violated"
                            }
                          },
                          "required": [
                            "rule_name",
                            "violation_description"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "tool_call_results_quick_reply_suggestions": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "tool_name": {
                              "type": "string"
                            },
                            "suggestions": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            }
                          },
                          "required": [
                            "tool_name",
                            "suggestions"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "assignment_choice_summary": {
                        "default": null,
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "strategy": {
                                "type": "string",
                                "const": "least-busy"
                              },
                              "selected": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "agent_id": {
                                        "type": "number"
                                      },
                                      "agent_name": {
                                        "type": "string"
                                      },
                                      "active_sessions": {
                                        "type": "number"
                                      },
                                      "active_sessions_in_group": {
                                        "type": "number"
                                      },
                                      "pending_sessions": {
                                        "type": "number"
                                      },
                                      "remaining_capacity": {
                                        "type": "number"
                                      },
                                      "max_capacity": {
                                        "type": "number"
                                      },
                                      "max_capacity_in_group": {
                                        "anyOf": [
                                          {
                                            "type": "number"
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "is_available_globally": {
                                        "type": "boolean"
                                      },
                                      "is_available_in_group": {
                                        "type": "boolean"
                                      },
                                      "missing_required_skills": {
                                        "default": [],
                                        "type": "array",
                                        "items": {
                                          "type": "object",
                                          "properties": {
                                            "id": {
                                              "type": "string"
                                            },
                                            "name": {
                                              "type": "string"
                                            }
                                          },
                                          "required": [
                                            "id",
                                            "name"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "pacing_until": {
                                        "default": null,
                                        "anyOf": [
                                          {
                                            "type": "string"
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "skip_reason": {
                                        "default": null,
                                        "anyOf": [
                                          {
                                            "type": "string",
                                            "enum": [
                                              "pacing"
                                            ]
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      }
                                    },
                                    "required": [
                                      "agent_id",
                                      "agent_name",
                                      "active_sessions",
                                      "active_sessions_in_group",
                                      "pending_sessions",
                                      "remaining_capacity",
                                      "max_capacity",
                                      "max_capacity_in_group",
                                      "is_available_globally",
                                      "is_available_in_group",
                                      "missing_required_skills",
                                      "pacing_until",
                                      "skip_reason"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "peers": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "agent_id": {
                                      "type": "number"
                                    },
                                    "agent_name": {
                                      "type": "string"
                                    },
                                    "active_sessions": {
                                      "type": "number"
                                    },
                                    "active_sessions_in_group": {
                                      "type": "number"
                                    },
                                    "pending_sessions": {
                                      "type": "number"
                                    },
                                    "remaining_capacity": {
                                      "type": "number"
                                    },
                                    "max_capacity": {
                                      "type": "number"
                                    },
                                    "max_capacity_in_group": {
                                      "anyOf": [
                                        {
                                          "type": "number"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "is_available_globally": {
                                      "type": "boolean"
                                    },
                                    "is_available_in_group": {
                                      "type": "boolean"
                                    },
                                    "missing_required_skills": {
                                      "default": [],
                                      "type": "array",
                                      "items": {
                                        "type": "object",
                                        "properties": {
                                          "id": {
                                            "type": "string"
                                          },
                                          "name": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "id",
                                          "name"
                                        ],
                                        "additionalProperties": false
                                      }
                                    },
                                    "pacing_until": {
                                      "default": null,
                                      "anyOf": [
                                        {
                                          "type": "string"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "skip_reason": {
                                      "default": null,
                                      "anyOf": [
                                        {
                                          "type": "string",
                                          "enum": [
                                            "pacing"
                                          ]
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    }
                                  },
                                  "required": [
                                    "agent_id",
                                    "agent_name",
                                    "active_sessions",
                                    "active_sessions_in_group",
                                    "pending_sessions",
                                    "remaining_capacity",
                                    "max_capacity",
                                    "max_capacity_in_group",
                                    "is_available_globally",
                                    "is_available_in_group",
                                    "missing_required_skills",
                                    "pacing_until",
                                    "skip_reason"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "required_skills": {
                                "default": [],
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "id": {
                                      "type": "string"
                                    },
                                    "name": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "id",
                                    "name"
                                  ],
                                  "additionalProperties": false
                                }
                              }
                            },
                            "required": [
                              "strategy",
                              "selected",
                              "peers",
                              "required_skills"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "integration_actor": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "system": {
                                "type": "string",
                                "enum": [
                                  "intercom"
                                ]
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "admin",
                                  "bot",
                                  "team",
                                  "workflow",
                                  "balanced",
                                  "unknown"
                                ]
                              },
                              "name": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "external_id": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "part_type": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "open_cx_user_id": {
                                "anyOf": [
                                  {
                                    "type": "number"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "system",
                              "kind",
                              "name",
                              "external_id"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "destination_id": {
                        "type": "string"
                      },
                      "destination_name": {
                        "type": "string"
                      },
                      "destination_type": {
                        "type": "string",
                        "enum": [
                          "hangup",
                          "phone",
                          "sip",
                          "team"
                        ]
                      },
                      "transfer_reason": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "is_failover": {
                        "type": "boolean"
                      },
                      "failover_source": {
                        "type": "string",
                        "enum": [
                          "stt",
                          "llm",
                          "tts"
                        ]
                      },
                      "hangup_initiator": {
                        "type": "string",
                        "enum": [
                          "user",
                          "agent",
                          "system"
                        ]
                      },
                      "hangup_reason": {
                        "type": "string"
                      },
                      "duration_seconds": {
                        "type": "number"
                      },
                      "call_direction": {
                        "type": "string",
                        "enum": [
                          "inbound",
                          "outbound"
                        ]
                      },
                      "voice_call": {
                        "type": "object",
                        "properties": {
                          "source": {
                            "type": "string",
                            "enum": [
                              "backend",
                              "livekit",
                              "voice_worker",
                              "twilio",
                              "vapi"
                            ]
                          },
                          "occurrence_id": {
                            "type": "string"
                          },
                          "failure": {
                            "type": "object",
                            "properties": {
                              "stage": {
                                "type": "string",
                                "enum": [
                                  "dispatch",
                                  "sip",
                                  "provider"
                                ]
                              },
                              "code": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "stage",
                              "code"
                            ],
                            "additionalProperties": false
                          },
                          "participant": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "userId": {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 9007199254740991
                              },
                              "phoneNumber": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "source"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "additionalProperties": false
                  }
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "knowledgebase_called": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "agent_assigned_by_integration",
              "agent_assigned_by_system",
              "agent_assigned_by_user",
              "agent_changed",
              "agent_comment",
              "agent_initiated_session",
              "agent_joined",
              "agent_message",
              "agent_message_deleted_by_agent",
              "agent_reopened_session",
              "agent_took_session_from_ai",
              "agent_unassigned_by_integration",
              "agent_unassigned_by_system",
              "agent_unassigned_by_user",
              "ai_assumed_the_session_resolved",
              "ai_decided_to_not_reply",
              "ai_decided_to_resolve_the_issue",
              "ai_follow_up_cancelled",
              "ai_follow_up_fired",
              "ai_follow_up_scheduled",
              "ai_reopened_session",
              "ai_response_cancelled",
              "ai_resumed_by_system",
              "ai_suggestion",
              "call_history",
              "call_transferred",
              "closed_resolved_by_agent",
              "closed_resolved_by_api",
              "closed_resolved_by_contact",
              "closed_resolved_by_integration",
              "closed_resolved_by_system",
              "closed_unresolved_by_agent",
              "closed_unresolved_by_api",
              "closed_unresolved_by_system",
              "contact_data_updated",
              "csat_request_cancelled",
              "csat_requested",
              "csat_submitted",
              "email_draft_message",
              "handoff",
              "handoff_to_salesforce_miaw",
              "handoff_to_third_party_failed",
              "handoff_to_zendesk",
              "integration_reopened_session",
              "ivr_selection",
              "merged_session_message",
              "message",
              "pii_attachment_removed",
              "primary_contact_changed",
              "prohibited_topic_detected",
              "quoted_content_modified",
              "salesforce_fields_updated",
              "sequence_message",
              "session_forwarded",
              "session_language_changed_by_agent",
              "session_language_changed_by_api",
              "session_language_changed_by_integration",
              "session_language_changed_by_system",
              "session_merged",
              "session_priority_changed_by_agent",
              "session_priority_changed_by_system",
              "session_snoozed",
              "session_subject_changed_by_system",
              "session_unsnoozed",
              "skills_added_by_system",
              "sla_applied_by_agent",
              "sla_applied_by_system",
              "sla_first_reply_breached",
              "sla_first_reply_completed_after_breach",
              "sla_first_reply_fulfilled",
              "sla_first_reply_metric_started",
              "sla_freezed_office_hours_ended",
              "sla_freezed_snoozed",
              "sla_next_reply_breached",
              "sla_next_reply_completed_after_breach",
              "sla_next_reply_fulfilled",
              "sla_next_reply_metric_started",
              "sla_removed_by_agent",
              "sla_removed_by_system",
              "sla_resolution_breached",
              "sla_resolution_completed_after_breach",
              "sla_resolution_fulfilled",
              "sla_resolution_metric_started",
              "sla_resolution_paused_resolved",
              "sla_resolution_paused_waiting_on_customer",
              "sla_resolution_resumed_customer_replied",
              "sla_resolution_resumed_reopened",
              "sla_resumed_office_hours_started",
              "sla_resumed_snooze_cancelled",
              "sla_resumed_snooze_expired",
              "state_checkpoint",
              "sub_session_created",
              "sub_session_linked_by_agent",
              "sub_session_linked_by_api",
              "sub_session_linked_by_integration",
              "sub_session_linked_by_system",
              "sub_session_unlinked_by_agent",
              "sub_session_unlinked_by_api",
              "sub_session_unlinked_by_integration",
              "sub_session_unlinked_by_system",
              "sub_status_removed_by_agent",
              "sub_status_removed_by_api",
              "sub_status_removed_by_integration",
              "sub_status_removed_by_system",
              "sub_status_set_by_agent",
              "sub_status_set_by_api",
              "sub_status_set_by_integration",
              "sub_status_set_by_system",
              "system_reopened_session",
              "tag_added_by_agent",
              "tag_added_by_api",
              "tag_added_by_integration",
              "tag_added_by_system",
              "tag_removed_by_agent",
              "tag_removed_by_api",
              "tag_removed_by_integration",
              "tag_removed_by_system",
              "team_assigned_by_integration",
              "team_assigned_by_system",
              "team_assigned_by_user",
              "team_unassigned_by_integration",
              "team_unassigned_by_system",
              "team_unassigned_by_user",
              "user_confirmed_the_session_resolved",
              "voice_call_ai_joined",
              "voice_call_ai_left",
              "voice_call_contact_answered",
              "voice_call_contact_joined",
              "voice_call_contact_left",
              "voice_call_ended",
              "voice_call_failed_to_start",
              "voice_call_human_answered",
              "voice_call_human_joined",
              "voice_call_human_left",
              "voice_call_started",
              "workflow_message",
              "workflow_note",
              "workflow_triggered"
            ]
          },
          "ivr_selection": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "runId": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  "seq": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "detail": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "prompt",
                          "keypad",
                          "result"
                        ]
                      },
                      "key": {
                        "type": "string"
                      },
                      "accepted": {
                        "type": "boolean"
                      },
                      "actor": {
                        "type": "string",
                        "enum": [
                          "caller",
                          "agent"
                        ]
                      }
                    },
                    "required": [
                      "kind"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "runId",
                  "seq",
                  "detail"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "extra_params": {
            "anyOf": [
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              },
              {
                "type": "null"
              }
            ]
          },
          "message_options": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/MessageOptionsDto"
              },
              {
                "type": "null"
              }
            ]
          },
          "agent_id": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "agent_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "agent_avatar": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "handoff_happened_during_office_hours": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ]
          },
          "sender_display_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "plan_executed": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ]
          },
          "contact_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "contact_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "contact_avatar_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "contact_source": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "csv",
                  "form",
                  "freshchat",
                  "hubspot",
                  "intercom",
                  "outbound",
                  "pipedream",
                  "salesforce",
                  "slack"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "contact_slack_data": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "attachments": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ChatAttachmentDto"
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "email_rfc_message_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "email_to": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "email_cc": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "external_message_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "csat_score": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "csat_feedback": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "state_checkpoint_payload": {
            "anyOf": [
              {},
              {
                "type": "null"
              }
            ]
          },
          "client_context": {
            "anyOf": [
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              },
              {
                "type": "null"
              }
            ]
          },
          "workflow_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "workflow_run_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "sequence_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "whatsapp_template_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "whatsapp_template_snapshot": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/WhatsAppTemplateDto"
              },
              {
                "type": "null"
              }
            ]
          },
          "from_opencx_public_api": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ]
          },
          "sub_status_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "whatsapp_sent_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "whatsapp_delivered_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "whatsapp_read_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "whatsapp_failed_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "whatsapp_error_title": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "whatsapp_error_details": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "twitter_sent_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "twitter_read_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "twitter_failed_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "twitter_error_title": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "twitter_error_details": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "session_closed_payload": {},
          "agent_changed_payload": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AgentChangedPayload"
              },
              {
                "type": "null"
              }
            ]
          },
          "comment_thread_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "edited_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "deleted_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "phone_call_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "phone_call": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PhoneCallDto"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "uuid",
          "session_id",
          "type",
          "session_closed_payload"
        ],
        "additionalProperties": false
      },
      "SalesforceAiReplyTemplateDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SalesforceAiReplyTemplateDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "name": {
            "type": "string"
          },
          "template_html": {
            "type": "string"
          },
          "is_default": {
            "type": "boolean"
          },
          "rules": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SalesforceReplyTemplateRules"
              },
              {
                "type": "null"
              }
            ]
          },
          "from_address": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "From address of the AI agent's autopilot Case email: a literal address, a {{session attribute}} such as {{sf_case_LatestPOSEmail__c}}, or an {{#if …}} branch, resolved per session. Used only when it resolves to an email address; otherwise Salesforce's default sender applies. Empty or null clears it."
          },
          "to_address": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "To address of the AI agent's autopilot Case email: a literal address, a {{session attribute}} such as {{reservation_email}}, or an {{#if …}} branch, resolved per session. Used only when it resolves to an email address; otherwise the Case contact's address applies. Empty or null clears it."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "name",
          "template_html",
          "is_default",
          "rules",
          "from_address",
          "to_address",
          "created_at",
          "updated_at"
        ],
        "additionalProperties": false
      },
      "SalesforceAiReplyTemplatesListDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SalesforceAiReplyTemplatesListDto",
        "type": "object",
        "properties": {
          "templates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SalesforceAiReplyTemplateDto"
            }
          }
        },
        "required": [
          "templates"
        ],
        "additionalProperties": false
      },
      "SalesforceAiReplyTemplatePreviewDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SalesforceAiReplyTemplatePreviewDto",
        "type": "object",
        "properties": {
          "html": {
            "type": "string"
          },
          "text": {
            "type": "string"
          },
          "session_number": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "missing_variables": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "from_address": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "to_address": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "html",
          "text",
          "session_number",
          "missing_variables",
          "from_address",
          "to_address"
        ],
        "additionalProperties": false
      },
      "VersionHistoryItemDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/VersionHistoryItemDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "instruction_id": {
            "type": "string"
          },
          "version_number": {
            "type": "number"
          },
          "question": {
            "type": "string"
          },
          "answer": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "BEHAVIORAL",
              "SCENARIO_SPECIFIC"
            ]
          },
          "published_at": {
            "type": "string",
            "format": "date-time"
          },
          "published_by": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "published_by_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "start_time": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "end_time": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "instruction_id",
          "version_number",
          "question",
          "answer",
          "type",
          "published_at",
          "published_by",
          "published_by_name",
          "created_at",
          "start_time",
          "end_time"
        ],
        "additionalProperties": false
      },
      "AvailabilityStatusDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/AvailabilityStatusDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "org_id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "group_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sort_order": {
            "type": "number"
          },
          "availability_type": {
            "type": "string",
            "enum": [
              "offline",
              "online"
            ],
            "description": "What applying the status does to the agent: 'online' turns main availability on with the status's teams; 'offline' turns main availability and every support team off (e.g. a Break status)"
          },
          "color": {
            "type": "string",
            "enum": [
              "blue",
              "gray",
              "green",
              "orange",
              "red"
            ],
            "description": "Display color for the status dot across the dashboard"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "deleted_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "org_id",
          "name",
          "group_ids",
          "sort_order",
          "availability_type",
          "color",
          "created_at",
          "updated_at",
          "deleted_at"
        ],
        "additionalProperties": false
      },
      "SankeyReportResDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SankeyReportResDto",
        "type": "object",
        "properties": {
          "nodes": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "dimensionKey": {
                  "type": "string",
                  "enum": [
                    "all_tickets",
                    "replied_by",
                    "outcome",
                    "handoff",
                    "channel",
                    "integration_source",
                    "assist_mode",
                    "contact_custom_data",
                    "session_custom_data",
                    "sentiment",
                    "status",
                    "assigned_team",
                    "contact_source",
                    "csat",
                    "handoff_reason",
                    "contact_reason"
                  ]
                },
                "dimensionLabel": {
                  "type": "string"
                },
                "bucket": {
                  "type": "string"
                },
                "count": {
                  "type": "number"
                }
              },
              "required": [
                "id",
                "dimensionKey",
                "dimensionLabel",
                "bucket",
                "count"
              ],
              "additionalProperties": false
            }
          },
          "links": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "source": {
                  "type": "string"
                },
                "target": {
                  "type": "string"
                },
                "value": {
                  "type": "number"
                }
              },
              "required": [
                "source",
                "target",
                "value"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "nodes",
          "links"
        ],
        "additionalProperties": false
      },
      "SankeyTicketsResDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SankeyTicketsResDto",
        "type": "object",
        "properties": {
          "tickets": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "ticketNumber": {
                  "type": "number"
                },
                "channel": {
                  "type": "string"
                },
                "aiClosureType": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "mainStatus": {
                  "type": "string"
                },
                "sentiment": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "createdAt": {
                  "type": "string"
                },
                "lastMessage": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "contactName": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "contactEmail": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "id",
                "ticketNumber",
                "channel",
                "aiClosureType",
                "mainStatus",
                "sentiment",
                "createdAt",
                "lastMessage",
                "contactName",
                "contactEmail"
              ],
              "additionalProperties": false
            }
          },
          "total": {
            "type": "number"
          },
          "hasMore": {
            "type": "boolean"
          }
        },
        "required": [
          "tickets",
          "total",
          "hasMore"
        ],
        "additionalProperties": false
      },
      "SankeyDimensionCatalogResDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SankeyDimensionCatalogResDto",
        "type": "object",
        "properties": {
          "dimensions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string",
                  "enum": [
                    "all_tickets",
                    "replied_by",
                    "outcome",
                    "handoff",
                    "channel",
                    "integration_source",
                    "assist_mode",
                    "contact_custom_data",
                    "session_custom_data",
                    "sentiment",
                    "status",
                    "assigned_team",
                    "contact_source",
                    "csat",
                    "handoff_reason",
                    "contact_reason"
                  ]
                },
                "label": {
                  "type": "string"
                },
                "requiresCustomDataKey": {
                  "type": "boolean"
                },
                "customDataKeys": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              },
              "required": [
                "key",
                "label",
                "requiresCustomDataKey"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "dimensions"
        ],
        "additionalProperties": false
      },
      "MacroTranslationsDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/MacroTranslationsDto",
        "type": "object",
        "properties": {
          "saved_reply_id": {
            "type": "string"
          },
          "source_language": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "language": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "pending",
                    "ready",
                    "failed"
                  ]
                },
                "title": {
                  "type": "string"
                },
                "content": {
                  "type": "string"
                },
                "options": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "label": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "label"
                    ],
                    "additionalProperties": false
                  }
                },
                "updated_at": {
                  "type": "string",
                  "format": "date-time"
                }
              },
              "required": [
                "language",
                "status",
                "title",
                "content",
                "options",
                "updated_at"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "saved_reply_id",
          "source_language",
          "items"
        ],
        "additionalProperties": false
      },
      "RetranslateMacroResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/RetranslateMacroResponseDto",
        "type": "object",
        "properties": {
          "queued_languages": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "queued_languages"
        ],
        "additionalProperties": false
      },
      "StructuredFieldGroupDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/StructuredFieldGroupDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "org_id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "position": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "archived_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "org_id",
          "name",
          "description",
          "position",
          "archived_at",
          "created_at",
          "updated_at"
        ],
        "additionalProperties": false
      },
      "StructuredFieldGroupListDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/StructuredFieldGroupListDto",
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/StructuredFieldGroupDto"
        }
      },
      "StructuredFieldSystemOptionDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/StructuredFieldSystemOptionDto",
        "type": "object",
        "properties": {
          "value": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "value",
          "label",
          "description"
        ],
        "additionalProperties": false
      },
      "StructuredFieldVariantTreeDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/StructuredFieldVariantTreeDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "org_id": {
            "type": "string"
          },
          "field_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "parent_id": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              {
                "type": "null"
              }
            ]
          },
          "value": {
            "type": "string"
          },
          "variant_display_name": {
            "type": "string"
          },
          "variant_description": {
            "type": "string"
          },
          "position": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "archived_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "children": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StructuredFieldVariantTreeDto"
            }
          }
        },
        "required": [
          "id",
          "org_id",
          "field_id",
          "parent_id",
          "value",
          "variant_display_name",
          "variant_description",
          "position",
          "archived_at",
          "created_at",
          "updated_at",
          "children"
        ],
        "additionalProperties": false
      },
      "StructuredFieldTreeDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/StructuredFieldTreeDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "org_id": {
            "type": "string"
          },
          "key": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "type": {
            "$ref": "#/components/schemas/StructuredFieldTypeDto"
          },
          "value": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "position": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "archived_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "show_when_field_id": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              {
                "type": "null"
              }
            ]
          },
          "show_when_values": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "group_id": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              {
                "type": "null"
              }
            ]
          },
          "variants": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StructuredFieldVariantTreeDto"
            }
          },
          "system_options": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StructuredFieldSystemOptionDto"
            }
          }
        },
        "required": [
          "id",
          "org_id",
          "key",
          "name",
          "description",
          "type",
          "value",
          "position",
          "archived_at",
          "created_at",
          "updated_at",
          "show_when_field_id",
          "show_when_values",
          "group_id",
          "variants",
          "system_options"
        ],
        "additionalProperties": false
      },
      "StructuredFieldListDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/StructuredFieldListDto",
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/StructuredFieldTreeDto"
        }
      },
      "MacroAttachmentDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/MacroAttachmentDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "size": {
            "type": "number"
          },
          "type": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "size",
          "type",
          "url"
        ],
        "additionalProperties": false
      },
      "SavedReplyDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SavedReplyDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "org_id": {
            "type": "string"
          },
          "category": {
            "type": "string",
            "description": "Group the macro belongs to: a section in Settings → Macros and in the inbox macro picker. \"general\" when it has none."
          },
          "title": {
            "type": "string"
          },
          "content": {
            "type": "string",
            "description": "Macro body as channel-safe HTML, with {{variable}} references."
          },
          "attachments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MacroAttachmentDto"
            }
          },
          "options": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MessageOptionDto"
            }
          },
          "user_id": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "created_by_user_id": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Authenticated creator, when known. Read-only; null for legacy or integration-created macros."
          },
          "overrides_saved_reply_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "exclude_from_suggestions": {
            "type": "boolean"
          },
          "allowed_team_ids": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Teams whose agents see this macro in the inbox. Empty = every agent. Admins with Macros settings access always see it. Org-wide macros only."
          },
          "source_language": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "org_id",
          "category",
          "title",
          "content",
          "attachments",
          "options",
          "user_id",
          "created_by_user_id",
          "overrides_saved_reply_id",
          "exclude_from_suggestions",
          "allowed_team_ids",
          "source_language",
          "created_at",
          "updated_at"
        ],
        "additionalProperties": false
      },
      "CustomSessionStatusDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CustomSessionStatusDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "org_id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "display_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "display_description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "color": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "icon": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "parent_status": {
            "type": "string",
            "enum": [
              "closed_resolved",
              "closed_unresolved",
              "open"
            ]
          },
          "allowed_group_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "org_id",
          "name",
          "description",
          "display_name",
          "display_description",
          "color",
          "icon",
          "parent_status",
          "allowed_group_ids",
          "created_at",
          "updated_at"
        ],
        "additionalProperties": false
      },
      "SessionStructuredFieldValueListItemDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SessionStructuredFieldValueListItemDto",
        "type": "object",
        "properties": {
          "org_id": {
            "type": "string"
          },
          "session_id": {
            "type": "string"
          },
          "field_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "value": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "field_key": {
            "type": "string"
          }
        },
        "required": [
          "org_id",
          "session_id",
          "field_id",
          "value",
          "created_at",
          "updated_at",
          "field_key"
        ],
        "additionalProperties": false
      },
      "SessionStructuredFieldValueListDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SessionStructuredFieldValueListDto",
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SessionStructuredFieldValueListItemDto"
            }
          },
          "applicable_field_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            }
          }
        },
        "required": [
          "data",
          "applicable_field_ids"
        ],
        "additionalProperties": false
      },
      "GenericResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/GenericResponseDto",
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "success": {
                "type": "boolean"
              }
            },
            "required": [
              "success"
            ],
            "additionalProperties": false
          },
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "status": {
                "type": "number"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "status",
              "message"
            ],
            "additionalProperties": false
          }
        },
        "additionalProperties": false
      },
      "CompanyAgentOwner": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CompanyAgentOwner",
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "The teammate’s OpenCX user id"
          },
          "name": {
            "type": "string",
            "description": "The teammate’s name in this organization, as set on their profile"
          },
          "email": {
            "type": "string",
            "format": "email",
            "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
          }
        },
        "required": [
          "id",
          "name",
          "email"
        ],
        "additionalProperties": false
      },
      "Company": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/Company",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "external_id": {
            "type": "string",
            "description": "The organization's own key for this company"
          },
          "name": {
            "type": "string"
          },
          "custom_data": {
            "anyOf": [
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "number"
                    },
                    {
                      "type": "boolean"
                    }
                  ]
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "agent_owner": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CompanyAgentOwner"
              },
              {
                "type": "null"
              }
            ],
            "description": "The teammate who owns this account. Null when nobody owns it, which is the ordinary state."
          },
          "created_at": {
            "type": "string",
            "description": "ISO 8601 timestamp of when the company was created"
          },
          "updated_at": {
            "type": "string",
            "description": "ISO 8601 timestamp of when the company was last updated"
          }
        },
        "required": [
          "id",
          "external_id",
          "name",
          "custom_data",
          "agent_owner",
          "created_at",
          "updated_at"
        ],
        "additionalProperties": false
      },
      "ListCompaniesOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ListCompaniesOutput",
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Company"
            }
          },
          "total": {
            "type": "number"
          },
          "page": {
            "type": "number"
          },
          "limit": {
            "type": "number"
          }
        },
        "required": [
          "data",
          "total",
          "page",
          "limit"
        ],
        "additionalProperties": false
      },
      "GetContactCompaniesOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/GetContactCompaniesOutput",
        "type": "object",
        "properties": {
          "companies": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Company"
            },
            "description": "Empty when the contact belongs to no company"
          }
        },
        "required": [
          "companies"
        ],
        "additionalProperties": false
      },
      "LinkContactCompanyOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/LinkContactCompanyOutput",
        "type": "object",
        "properties": {
          "outcome": {
            "type": "string",
            "enum": [
              "linked",
              "unchanged"
            ],
            "description": "`unchanged` means the contact was already in this company."
          },
          "company": {
            "$ref": "#/components/schemas/Company"
          }
        },
        "required": [
          "outcome",
          "company"
        ],
        "additionalProperties": false
      },
      "BulkLinkContactsOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/BulkLinkContactsOutput",
        "type": "object",
        "properties": {
          "results": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "contact_id": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "The resolved contact id. Null when the identifier did not resolve."
                },
                "external_id": {
                  "type": "string"
                },
                "outcome": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "linked",
                        "unchanged"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "error": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Null when this contact linked successfully"
                },
                "company": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/Company"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "contact_id",
                "external_id",
                "outcome",
                "error",
                "company"
              ],
              "additionalProperties": false
            },
            "description": "One entry per requested link, in request order"
          },
          "summary": {
            "type": "object",
            "properties": {
              "total": {
                "type": "number"
              },
              "linked": {
                "type": "number"
              },
              "unchanged": {
                "type": "number"
              },
              "failed": {
                "type": "number"
              }
            },
            "required": [
              "total",
              "linked",
              "unchanged",
              "failed"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "results",
          "summary"
        ],
        "additionalProperties": false
      },
      "UnlinkContactCompanyOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UnlinkContactCompanyOutput",
        "type": "object",
        "properties": {
          "outcome": {
            "type": "string",
            "enum": [
              "unlinked",
              "unchanged"
            ],
            "description": "`unchanged` means the contact was not in that company."
          }
        },
        "required": [
          "outcome"
        ],
        "additionalProperties": false
      },
      "ContactStructuredFieldValueListItemDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ContactStructuredFieldValueListItemDto",
        "type": "object",
        "properties": {
          "org_id": {
            "type": "string"
          },
          "contact_id": {
            "type": "string"
          },
          "field_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "value": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "field_key": {
            "type": "string"
          }
        },
        "required": [
          "org_id",
          "contact_id",
          "field_id",
          "value",
          "created_at",
          "updated_at",
          "field_key"
        ],
        "additionalProperties": false
      },
      "ContactStructuredFieldValueListDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ContactStructuredFieldValueListDto",
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContactStructuredFieldValueListItemDto"
            }
          },
          "applicable_field_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            }
          }
        },
        "required": [
          "data",
          "applicable_field_ids"
        ],
        "additionalProperties": false
      },
      "SalesforceCrmContactDetailsDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SalesforceCrmContactDetailsDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "salesforce_record_id": {
            "type": "string"
          },
          "record_type": {
            "type": "string",
            "enum": [
              "Contact",
              "Lead"
            ]
          },
          "email": {
            "type": "string"
          },
          "phone": {
            "type": "string"
          },
          "first_name": {
            "type": "string"
          },
          "last_name": {
            "type": "string"
          },
          "company": {
            "type": "string"
          },
          "salesforce_data": {},
          "cached_at": {
            "type": "string"
          },
          "salesforce_link": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "salesforce_record_id",
          "record_type",
          "salesforce_data",
          "cached_at",
          "salesforce_link"
        ],
        "additionalProperties": false
      },
      "SalesforceCrmAccountDetailsDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SalesforceCrmAccountDetailsDto",
        "type": "object",
        "properties": {
          "salesforce_account_id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "website": {
            "type": "string"
          },
          "industry": {
            "type": "string"
          },
          "number_of_employees": {
            "type": "string"
          },
          "annual_revenue": {
            "type": "string"
          },
          "billing_city": {
            "type": "string"
          },
          "billing_state": {
            "type": "string"
          },
          "billing_country": {
            "type": "string"
          },
          "salesforce_data": {},
          "salesforce_link": {
            "type": "string"
          }
        },
        "required": [
          "salesforce_account_id",
          "salesforce_data",
          "salesforce_link"
        ],
        "additionalProperties": false
      },
      "SalesforceCrmOpportunityDetailsDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SalesforceCrmOpportunityDetailsDto",
        "type": "object",
        "properties": {
          "salesforce_opportunity_id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "stage_name": {
            "type": "string"
          },
          "amount": {
            "type": "string"
          },
          "close_date": {
            "type": "string"
          },
          "is_closed": {
            "type": "boolean"
          },
          "is_won": {
            "type": "boolean"
          },
          "salesforce_data": {},
          "salesforce_link": {
            "type": "string"
          }
        },
        "required": [
          "salesforce_opportunity_id",
          "salesforce_data",
          "salesforce_link"
        ],
        "additionalProperties": false
      },
      "SalesforceCrmCaseDetailsDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SalesforceCrmCaseDetailsDto",
        "type": "object",
        "properties": {
          "salesforce_case_id": {
            "type": "string"
          },
          "case_number": {
            "type": "string"
          },
          "subject": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "priority": {
            "type": "string"
          },
          "origin": {
            "type": "string"
          },
          "created_date": {
            "type": "string"
          },
          "last_modified_date": {
            "type": "string"
          },
          "salesforce_data": {},
          "salesforce_link": {
            "type": "string"
          }
        },
        "required": [
          "salesforce_case_id",
          "salesforce_data",
          "salesforce_link"
        ],
        "additionalProperties": false
      },
      "SalesforceCrmCustomObjectRecordDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SalesforceCrmCustomObjectRecordDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "values": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "number"
                },
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "salesforce_link": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "values",
          "salesforce_link"
        ],
        "additionalProperties": false
      },
      "SalesforceCrmCustomObjectSectionDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SalesforceCrmCustomObjectSectionDto",
        "type": "object",
        "properties": {
          "object_api_name": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "records": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SalesforceCrmCustomObjectRecordDto"
            }
          }
        },
        "required": [
          "object_api_name",
          "label"
        ],
        "additionalProperties": false
      },
      "ConsumerSalesforceCrmContactResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ConsumerSalesforceCrmContactResponseDto",
        "type": "object",
        "properties": {
          "consumer_id": {
            "type": "string"
          },
          "consumer_email": {
            "type": "string"
          },
          "consumer_phone": {
            "type": "string"
          },
          "salesforce_contact": {
            "$ref": "#/components/schemas/SalesforceCrmContactDetailsDto"
          },
          "accounts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SalesforceCrmAccountDetailsDto"
            }
          },
          "opportunities": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SalesforceCrmOpportunityDetailsDto"
            }
          },
          "previous_cases": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SalesforceCrmCaseDetailsDto"
            }
          },
          "custom_objects": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SalesforceCrmCustomObjectSectionDto"
            }
          },
          "found_in_salesforce": {
            "type": "boolean"
          },
          "lookup_status": {
            "type": "string",
            "enum": [
              "found",
              "none",
              "failed"
            ]
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "consumer_id",
          "found_in_salesforce",
          "lookup_status",
          "message"
        ],
        "additionalProperties": false
      },
      "CsatSettingsResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CsatSettingsResponseDto",
        "type": "object",
        "properties": {
          "organization_id": {
            "type": "string",
            "description": "The ID of the organization"
          },
          "web_enabled": {
            "type": "boolean",
            "description": "Whether CSAT collection is enabled for web channel"
          },
          "email_enabled": {
            "type": "boolean",
            "description": "Whether CSAT collection is enabled for email channel"
          },
          "phone_enabled": {
            "type": "boolean",
            "description": "Whether CSAT collection is enabled for phone channel"
          },
          "whatsapp_enabled": {
            "type": "boolean",
            "description": "Whether CSAT collection is enabled for WhatsApp channel"
          },
          "sms_enabled": {
            "type": "boolean",
            "description": "Whether CSAT collection is enabled for SMS channel"
          },
          "slack_enabled": {
            "type": "boolean",
            "description": "Whether CSAT collection is enabled for Slack channel"
          },
          "api_enabled": {
            "type": "boolean",
            "description": "Whether CSAT collection is enabled for API channel"
          },
          "web_voice_enabled": {
            "type": "boolean",
            "description": "Whether CSAT collection is enabled for web voice channel"
          },
          "instagram_enabled": {
            "type": "boolean",
            "description": "Whether CSAT collection is enabled for Instagram channel"
          },
          "messenger_enabled": {
            "type": "boolean",
            "description": "Whether CSAT collection is enabled for Facebook Messenger channel"
          },
          "custom_message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Custom message to display with CSAT request"
          },
          "auto_send_on_close": {
            "type": "boolean",
            "description": "Whether to automatically send CSAT after session closes"
          },
          "send_delay_minutes": {
            "type": "number",
            "description": "Delay in minutes before sending CSAT after session closes"
          },
          "resend_policy": {
            "type": "string",
            "enum": [
              "always",
              "once_per_close",
              "once_per_session",
              "once_until_answered"
            ],
            "description": "How often the same session may be surveyed: once_per_session, once_per_close, once_until_answered, or always"
          },
          "resend_after_days": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Days to wait before re-asking an unanswered survey (only used when resend_policy is once_until_answered)"
          },
          "rescore_window_hours": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ],
            "description": "How long (hours, from the first submit) a customer may change their score (null = unlimited, 0 = locked immediately)"
          },
          "channel_config": {
            "type": "object",
            "propertyNames": {
              "$ref": "#/components/schemas/SessionChannel"
            },
            "additionalProperties": {
              "type": "object",
              "properties": {
                "rating_style": {
                  "description": "How the 1-5 scale is drawn on channels that render it in-conversation",
                  "type": "string",
                  "enum": [
                    "stars",
                    "emoji",
                    "numbers"
                  ]
                },
                "rating_order": {
                  "description": "Whether the scale is listed best-first (desc, default) or worst-first (asc)",
                  "type": "string",
                  "enum": [
                    "desc",
                    "asc"
                  ]
                },
                "custom_message": {
                  "description": "Survey question for this channel. Falls back to the org-wide custom_message",
                  "type": "string"
                }
              },
              "additionalProperties": false
            },
            "description": "Per-channel overrides keyed by channel; an absent channel inherits the org-wide settings"
          },
          "web_template_html": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Full-HTML template for the public CSAT feedback page (null = default page)"
          },
          "email_template_html": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Full-HTML template for the CSAT request email (null = default email)"
          },
          "email_template_subject": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Subject line for the custom CSAT request email (null = default subject)"
          },
          "created_at": {
            "description": "When the settings were created",
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "description": "When the settings were last updated",
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "organization_id",
          "web_enabled",
          "email_enabled",
          "phone_enabled",
          "whatsapp_enabled",
          "sms_enabled",
          "slack_enabled",
          "api_enabled",
          "web_voice_enabled",
          "instagram_enabled",
          "messenger_enabled",
          "custom_message",
          "auto_send_on_close",
          "send_delay_minutes",
          "resend_policy",
          "resend_after_days",
          "rescore_window_hours",
          "channel_config",
          "web_template_html",
          "email_template_html",
          "email_template_subject",
          "created_at",
          "updated_at"
        ],
        "additionalProperties": false
      },
      "CustomDomainMutationOutputDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CustomDomainMutationOutputDto",
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "const": true
          }
        },
        "required": [
          "success"
        ],
        "additionalProperties": false
      },
      "CustomDomainErrorDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CustomDomainErrorDto",
        "type": "object",
        "properties": {
          "statusCode": {
            "anyOf": [
              {
                "type": "number",
                "const": 400
              },
              {
                "type": "number",
                "const": 404
              },
              {
                "type": "number",
                "const": 503
              }
            ]
          },
          "message": {
            "type": "string"
          },
          "error": {
            "type": "string",
            "enum": [
              "domain_registered_elsewhere",
              "domain_create_failed",
              "domain_not_found",
              "domain_verify_failed",
              "domain_delete_failed",
              "domain_tracking_update_failed",
              "domain_provider_unavailable"
            ]
          }
        },
        "required": [
          "statusCode",
          "message",
          "error"
        ],
        "additionalProperties": false
      },
      "EmailTemplateActivityItemDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/EmailTemplateActivityItemDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "from_email": {
            "type": "string"
          },
          "email_subject": {
            "type": "string"
          },
          "email_sender_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "email_body": {
            "type": "string"
          },
          "inserted_at": {
            "type": "string",
            "format": "date-time"
          },
          "sent_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "resend_error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "to_email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "to_id": {
            "type": "string"
          },
          "to_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "from_email",
          "email_subject",
          "email_sender_name",
          "email_body",
          "inserted_at",
          "sent_at",
          "resend_error",
          "to_email",
          "to_id",
          "to_name"
        ],
        "additionalProperties": false
      },
      "EmailTemplateActivityResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/EmailTemplateActivityResponseDto",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EmailTemplateActivityItemDto"
            }
          },
          "total": {
            "type": "number"
          }
        },
        "required": [
          "items",
          "total"
        ],
        "additionalProperties": false
      },
      "EmailTemplateDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/EmailTemplateDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "actor_id": {
            "type": "number"
          },
          "body": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "name": {
            "type": "string"
          },
          "org_id": {
            "type": "string"
          },
          "subject": {
            "type": "string"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "payload": {
            "type": "object",
            "properties": {
              "$schema": {
                "type": "string"
              },
              "$id": {
                "type": "string"
              },
              "title": {
                "type": "string"
              },
              "description": {
                "type": "string"
              },
              "type": {
                "type": "string"
              },
              "definitions": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string"
                    },
                    "properties": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "type"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "required": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "description": {
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "type",
                    "properties",
                    "required"
                  ],
                  "additionalProperties": false
                }
              },
              "properties": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string"
                    },
                    "description": {
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "type"
                  ],
                  "additionalProperties": false
                }
              },
              "required": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "additionalProperties": {
                "type": "boolean"
              }
            },
            "required": [
              "definitions",
              "properties"
            ],
            "additionalProperties": {}
          },
          "language": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "variable_defaults": {
            "anyOf": [
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": "string"
                }
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "actor_id",
          "body",
          "created_at",
          "name",
          "org_id",
          "subject",
          "updated_at",
          "payload",
          "language",
          "variable_defaults"
        ],
        "additionalProperties": false
      },
      "GroupCategoryDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/GroupCategoryDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "name": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "name"
        ],
        "additionalProperties": false
      },
      "GroupDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/GroupDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "organization_id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "category_id": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              {
                "type": "null"
              }
            ]
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "is_support_enabled": {
            "type": "boolean"
          },
          "support_office_hours_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "support_assignment_strategy": {
            "type": "string",
            "enum": [
              "least-busy",
              "round-robin",
              "unassigned"
            ]
          },
          "call_wrap_up_seconds": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "telephony_pacing_enabled": {
            "type": "boolean"
          },
          "telephony_ring_seconds": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "telephony_queue_wait_seconds": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "telephony_distribution": {
            "type": "string",
            "enum": [
              "fewest_answered_today",
              "longest_available"
            ]
          },
          "phone_sla_policy_id": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              {
                "type": "null"
              }
            ]
          },
          "call_recording_enabled": {
            "type": "boolean"
          },
          "call_languages": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "auto_assign_interval_seconds": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "zendesk_group_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "zendesk_group_channels": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SessionChannel"
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "updated_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "deleted_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "organization_id",
          "name",
          "category_id",
          "description",
          "is_support_enabled",
          "support_office_hours_id",
          "support_assignment_strategy",
          "call_wrap_up_seconds",
          "telephony_pacing_enabled",
          "telephony_ring_seconds",
          "telephony_queue_wait_seconds",
          "telephony_distribution",
          "phone_sla_policy_id",
          "call_recording_enabled",
          "call_languages",
          "auto_assign_interval_seconds",
          "zendesk_group_id",
          "zendesk_group_channels",
          "created_at",
          "updated_at",
          "deleted_at"
        ],
        "additionalProperties": false
      },
      "GroupUsersDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/GroupUsersDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "number"
          },
          "name": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "is_available": {
            "type": "boolean"
          },
          "group_capacity": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "global_capacity": {
            "type": "number"
          }
        },
        "required": [
          "id",
          "name",
          "email",
          "is_available",
          "group_capacity",
          "global_capacity"
        ],
        "additionalProperties": false
      },
      "WebCallCredentialsDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/WebCallCredentialsDto",
        "type": "object",
        "properties": {
          "callId": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "sessionId": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "controlToken": {
            "type": "string"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
          }
        },
        "required": [
          "callId",
          "sessionId",
          "controlToken",
          "expiresAt"
        ],
        "additionalProperties": false
      },
      "WebCallStatusDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/WebCallStatusDto",
        "type": "object",
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "waiting",
              "queued",
              "connected",
              "ended"
            ]
          }
        },
        "required": [
          "state"
        ],
        "additionalProperties": false
      },
      "CreateMiniAppResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CreateMiniAppResponseDto",
        "type": "object",
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          }
        },
        "required": [
          "app_id"
        ],
        "additionalProperties": false
      },
      "SubmitMiniAppResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SubmitMiniAppResponseDto",
        "type": "object",
        "properties": {
          "app_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "version_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "version": {
            "type": "string"
          }
        },
        "required": [
          "app_id",
          "version_id",
          "version"
        ],
        "additionalProperties": false
      },
      "MiniAppSourceResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/MiniAppSourceResponseDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "source": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "description",
          "source"
        ],
        "additionalProperties": false
      },
      "UpdateMiniAppDetailsResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdateMiniAppDetailsResponseDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "enabled_channels": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "icon": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/MiniAppIcon"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "name",
          "description",
          "enabled_channels",
          "icon"
        ],
        "additionalProperties": false
      },
      "DefaultOfficeHoursResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/DefaultOfficeHoursResponseDto",
        "type": "object",
        "properties": {
          "iana_timezone": {
            "type": "string",
            "description": "IANA timezone (e.g. \"America/New_York\", \"Europe/London\")"
          },
          "exceptions": {
            "description": "Omit to preserve existing exceptions; send [] to clear them",
            "maxItems": 200,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OfficeHoursExceptionDto"
            }
          },
          "shifts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "Shift ID"
                },
                "day_of_week": {
                  "type": "string",
                  "enum": [
                    "everyday",
                    "friday",
                    "friday_and_saturday",
                    "monday",
                    "monday_to_friday",
                    "saturday",
                    "sunday",
                    "sunday_and_monday",
                    "sunday_to_thursday",
                    "thursday",
                    "tuesday",
                    "wednesday"
                  ],
                  "description": "Day(s) of week: \"monday\", \"tuesday\", \"wednesday\", \"thursday\", \"friday\", \"saturday\", \"sunday\", \"everyday\", \"monday_to_friday\", \"sunday_to_thursday\", \"friday_and_saturday\", \"sunday_and_monday\""
                },
                "start_time": {
                  "type": "string",
                  "description": "Start time in HH:mm:ss format (e.g. \"09:00:00\")"
                },
                "end_time": {
                  "type": "string",
                  "description": "End time in HH:mm:ss format (e.g. \"17:00:00\")"
                }
              },
              "required": [
                "id",
                "day_of_week",
                "start_time",
                "end_time"
              ],
              "additionalProperties": false
            },
            "description": "The time blocks when support is available"
          }
        },
        "required": [
          "iana_timezone",
          "shifts"
        ],
        "additionalProperties": false
      },
      "PhoneAgentVoiceDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/PhoneAgentVoiceDto",
        "type": "object",
        "properties": {
          "provider": {
            "type": "string",
            "enum": [
              "elevenlabs",
              "cartesia",
              "vapi",
              "live"
            ]
          },
          "voice_mode": {
            "type": "string",
            "enum": [
              "modular",
              "live"
            ]
          },
          "voice_id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "labels": {
            "type": "object",
            "properties": {
              "accent": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "description": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "age": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "gender": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "use_case": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "language": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "accent",
              "description",
              "age",
              "gender",
              "use_case",
              "language"
            ],
            "additionalProperties": false
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "preview_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "preview_urls": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "string"
            }
          },
          "default_speed_pct": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 1,
                "maximum": 100
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "provider",
          "voice_mode",
          "voice_id",
          "name",
          "labels",
          "description",
          "preview_url",
          "default_speed_pct"
        ],
        "additionalProperties": false
      },
      "AgentWorkflowItemDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/AgentWorkflowItemDto",
        "type": "object",
        "properties": {
          "workflowId": {
            "type": "string",
            "description": "The logical workflow UUID"
          },
          "name": {
            "type": "string",
            "description": "Display name of the workflow"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Description of the workflow"
          },
          "goal": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The goal of the workflow from AI trigger config"
          },
          "selected": {
            "type": "boolean",
            "description": "Whether this workflow is selected for the agent"
          }
        },
        "required": [
          "workflowId",
          "name",
          "description",
          "goal",
          "selected"
        ],
        "additionalProperties": false
      },
      "AgentWorkflowListDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/AgentWorkflowListDto",
        "type": "object",
        "properties": {
          "workflows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AgentWorkflowItemDto"
            }
          }
        },
        "required": [
          "workflows"
        ],
        "additionalProperties": false
      },
      "UpdateAgentWorkflowsResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdateAgentWorkflowsResponseDto",
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          }
        },
        "required": [
          "success"
        ],
        "additionalProperties": false
      },
      "PhoneAgentKnowledgePlanDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/PhoneAgentKnowledgePlanDto",
        "type": "object",
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "none",
              "preload",
              "search"
            ],
            "description": "How a save now would give the agent its selection. none: nothing is selected, so the agent only follows its own instructions. preload: every selected source is loaded at the start of each call. search: the selection is too large to load, so the agent searches it during calls."
          },
          "searchEnabled": {
            "type": "boolean",
            "description": "Whether the agent searches during calls now. Set when the agent is saved; differs from mode when the selected sources changed size since."
          },
          "selectedSourceCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Selected instructions and knowledge documents currently available to voice calls"
          },
          "capacityUsedPercent": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Share of the room for loading sources at call start that the agent's instructions and selection would use. Above 100, the agent searches instead."
          }
        },
        "required": [
          "mode",
          "searchEnabled",
          "selectedSourceCount",
          "capacityUsedPercent"
        ],
        "additionalProperties": false
      },
      "KnowledgeSourceRoutingGuideDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/KnowledgeSourceRoutingGuideDto",
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "fresh",
              "stale",
              "invalid"
            ]
          },
          "generatedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
          },
          "generationDurationMs": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "schemaVersion": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          },
          "sourceCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "concepts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "kind": {
                  "type": "string",
                  "enum": [
                    "audience",
                    "product",
                    "intent_family",
                    "state_axis",
                    "vocabulary"
                  ]
                },
                "label": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "aliases": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "sourceCount": {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "maximum": 9007199254740991
                },
                "confidence": {
                  "type": "number",
                  "minimum": 0,
                  "maximum": 1
                }
              },
              "required": [
                "id",
                "kind",
                "label",
                "description",
                "aliases",
                "sourceCount",
                "confidence"
              ],
              "additionalProperties": false
            }
          },
          "distinctions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "conceptIds": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "relationship": {
                  "type": "string",
                  "enum": [
                    "confusable",
                    "overlapping",
                    "narrower_broader",
                    "complementary",
                    "mutually_exclusive"
                  ]
                },
                "distinction": {
                  "type": "string"
                },
                "clarifyingQuestion": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "confidence": {
                  "type": "number",
                  "minimum": 0,
                  "maximum": 1
                }
              },
              "required": [
                "conceptIds",
                "relationship",
                "distinction",
                "clarifyingQuestion",
                "confidence"
              ],
              "additionalProperties": false
            }
          },
          "toolTransitions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "toolName": {
                  "type": "string"
                },
                "outcomeFields": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "conditions": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "field": {
                        "type": "string"
                      },
                      "operator": {
                        "type": "string",
                        "enum": [
                          "equals",
                          "not_equals",
                          "one_of",
                          "present",
                          "absent",
                          "truthy",
                          "falsy"
                        ]
                      },
                      "values": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    },
                    "required": [
                      "field",
                      "operator",
                      "values"
                    ],
                    "additionalProperties": false
                  }
                },
                "searchIntent": {
                  "type": "string"
                },
                "confidence": {
                  "type": "number",
                  "minimum": 0,
                  "maximum": 1
                }
              },
              "required": [
                "toolName",
                "outcomeFields",
                "conditions",
                "searchIntent",
                "confidence"
              ],
              "additionalProperties": false
            }
          },
          "changeSet": {
            "type": "object",
            "properties": {
              "addedConceptIds": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "updatedConceptIds": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "removedConceptIds": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "addedConceptIds",
              "updatedConceptIds",
              "removedConceptIds"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "status",
          "generatedAt",
          "generationDurationMs",
          "schemaVersion",
          "sourceCount",
          "concepts",
          "distinctions",
          "toolTransitions",
          "changeSet"
        ],
        "additionalProperties": false
      },
      "KnowledgeSourceTreeItemDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/KnowledgeSourceTreeItemDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "question": {
            "type": "string",
            "description": "The scenario/title of the instruction"
          },
          "answer": {
            "type": "string",
            "description": "The content of the instruction"
          },
          "directory_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "selected": {
            "type": "boolean",
            "description": "Whether this instruction is individually selected"
          },
          "selectable": {
            "type": "boolean",
            "description": "Whether this source can be selected for a voice agent"
          },
          "unavailableReason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "User-facing explanation when the source cannot be selected"
          }
        },
        "required": [
          "id",
          "question",
          "answer",
          "directory_id",
          "selected",
          "selectable",
          "unavailableReason"
        ],
        "additionalProperties": false
      },
      "KnowledgeSourceDirectoryDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/KnowledgeSourceDirectoryDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "parent_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Parent directory id; null for a top-level directory"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/KnowledgeSourceTreeItemDto"
            }
          },
          "selected": {
            "type": "boolean",
            "description": "Whether the entire directory is selected (all current and future instructions included)"
          },
          "selectable": {
            "type": "boolean",
            "description": "Whether this source can be selected for a voice agent"
          },
          "unavailableReason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "User-facing explanation when the source cannot be selected"
          }
        },
        "required": [
          "id",
          "name",
          "parent_id",
          "items",
          "selected",
          "selectable",
          "unavailableReason"
        ],
        "additionalProperties": false
      },
      "KnowledgeSourceTreeDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/KnowledgeSourceTreeDto",
        "type": "object",
        "properties": {
          "directories": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/KnowledgeSourceDirectoryDto"
            }
          },
          "uncategorized": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/KnowledgeSourceTreeItemDto"
            }
          },
          "totalTokens": {
            "type": "number",
            "description": "Estimated tokens of the selected instructions and knowledge documents"
          },
          "instructionMode": {
            "type": "string",
            "enum": [
              "all",
              "selected"
            ],
            "description": "Deprecated: always selected. The agent only uses the instructions selected here."
          },
          "knowledgeMode": {
            "type": "string",
            "enum": [
              "all",
              "selected"
            ],
            "description": "Deprecated: always selected. The agent only uses the knowledge selected here."
          },
          "knowledgePlan": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PhoneAgentKnowledgePlanDto"
              },
              {
                "type": "null"
              }
            ],
            "description": "How the agent gets the selected sources during calls; null for agents on another runtime"
          },
          "selectedInstructionIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "selectedDirectoryIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "selectedKnowledgeItemIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "selectedKnowledgeFolderKeys": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "routingGuide": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/KnowledgeSourceRoutingGuideDto"
              },
              {
                "type": "null"
              }
            ]
          },
          "knowledgeFolders": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string"
                },
                "dataSource": {
                  "type": "string",
                  "enum": [
                    "confluence",
                    "notion",
                    "zendesk_support",
                    "shopify",
                    "gitbook",
                    "intercom",
                    "front",
                    "freshdesk",
                    "hubspot_kb",
                    "ai_instructions",
                    "custom_training",
                    "website",
                    "workflow",
                    "help_center"
                  ]
                },
                "stream": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "label": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "documentCount": {
                  "type": "number"
                },
                "selected": {
                  "type": "boolean"
                },
                "selectable": {
                  "type": "boolean",
                  "description": "Whether this source can be selected for a voice agent"
                },
                "unavailableReason": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "User-facing explanation when the source cannot be selected"
                }
              },
              "required": [
                "key",
                "dataSource",
                "stream",
                "label",
                "documentCount",
                "selected",
                "selectable",
                "unavailableReason"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "directories",
          "uncategorized",
          "totalTokens",
          "instructionMode",
          "knowledgeMode",
          "knowledgePlan",
          "selectedInstructionIds",
          "selectedDirectoryIds",
          "selectedKnowledgeItemIds",
          "selectedKnowledgeFolderKeys",
          "routingGuide",
          "knowledgeFolders"
        ],
        "additionalProperties": false
      },
      "UpdateKnowledgeSourcesResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdateKnowledgeSourcesResponseDto",
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "totalTokens": {
            "type": "number",
            "description": "Estimated tokens of the selected instructions and knowledge documents"
          },
          "instructionMode": {
            "type": "string",
            "enum": [
              "all",
              "selected"
            ],
            "description": "Deprecated: always selected."
          },
          "knowledgeMode": {
            "type": "string",
            "enum": [
              "all",
              "selected"
            ],
            "description": "Deprecated: always selected."
          },
          "knowledgePlan": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PhoneAgentKnowledgePlanDto"
              },
              {
                "type": "null"
              }
            ],
            "description": "How the agent gets the selected sources during calls; null for agents on another runtime"
          },
          "selectedInstructionIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "selectedDirectoryIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "selectedKnowledgeItemIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "selectedKnowledgeFolderKeys": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "success",
          "totalTokens",
          "instructionMode",
          "knowledgeMode",
          "knowledgePlan",
          "selectedInstructionIds",
          "selectedDirectoryIds",
          "selectedKnowledgeItemIds",
          "selectedKnowledgeFolderKeys"
        ],
        "additionalProperties": false
      },
      "MakeOutboundCallResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/MakeOutboundCallResponseDto",
        "type": "object",
        "properties": {
          "error": {
            "description": "Error details if the call failed",
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "status": {
                "type": "number"
              }
            },
            "additionalProperties": false
          },
          "result": {
            "description": "Raw call result from the provider"
          },
          "sessionId": {
            "description": "ID of the session created for this call, available at dial time. Use it to correlate call webhooks (phone_call.started / phone_call.ended carry the same session_id) and to fetch the session — including its custom data — after the call.",
            "type": "string"
          },
          "callId": {
            "description": "Provider call ID",
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "OutboundCallCapacityError": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/OutboundCallCapacityError",
        "type": "object",
        "properties": {
          "statusCode": {
            "anyOf": [
              {
                "type": "number",
                "const": 429
              },
              {
                "type": "number",
                "const": 503
              }
            ]
          },
          "message": {
            "type": "string"
          },
          "error": {
            "description": "outbound_call_org_limit or outbound_call_global_limit for call capacity rejection; outbound_call_capacity_unavailable when capacity cannot be checked; feature_limit_reached when the monthly AI voice minutes limit set in Billing is reached.",
            "type": "string"
          }
        },
        "required": [
          "statusCode",
          "message"
        ],
        "additionalProperties": false
      },
      "TransferDestinationDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/TransferDestinationDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "hangup",
              "phone",
              "sip",
              "team"
            ]
          },
          "value": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "sipUsername": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "hasSipPassword": {
            "type": "boolean"
          },
          "sipHeaderNames": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Names of the custom SIP headers sent on every transfer to this destination. Values are never returned."
          },
          "sipHost": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "sipPort": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "sipExtension": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "sipTransport": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "udp",
                  "tcp",
                  "tls"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "sipCallerId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "sipHeaderAllowlist": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "sipPreserveCallerId": {
            "type": "boolean"
          },
          "sipMediaEncryption": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "allow",
                  "require"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "routingGroupId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "type",
          "value",
          "sipUsername",
          "hasSipPassword",
          "sipHeaderNames",
          "sipHost",
          "sipPort",
          "sipExtension",
          "sipTransport",
          "sipCallerId",
          "sipHeaderAllowlist",
          "sipPreserveCallerId",
          "sipMediaEncryption",
          "routingGroupId",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "VerifiedPhoneNumberDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/VerifiedPhoneNumberDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "phone_number": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "failed",
              "pending",
              "verified"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "twilio_custom_identity",
              "twilio_standard_phone_number",
              "twilio_whatsapp"
            ]
          },
          "friendly_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "emoji": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 8
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "verified_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "assigned_ivr_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "assigned_ivr_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "assigned_agent_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "assigned_agent_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "assigned_agent_provider": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "vapi",
                  "openai-realtime-voice",
                  "livekit"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "assigned_interpreter_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "assigned_interpreter_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "region": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "apac",
                  "eu",
                  "us"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "twilio_phone_number_sid": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "phone_number",
          "status",
          "type",
          "friendly_name",
          "emoji",
          "created_at",
          "verified_at"
        ],
        "additionalProperties": false
      },
      "SlaOverviewResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SlaOverviewResponseDto",
        "type": "object",
        "properties": {
          "coverage_rate": {
            "type": "number"
          },
          "total_sessions": {
            "type": "number"
          },
          "sla_sessions": {
            "type": "number"
          },
          "compliance": {
            "type": "object",
            "properties": {
              "overall": {
                "type": "number"
              },
              "first_reply": {
                "type": "object",
                "properties": {
                  "fulfilled": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "breached": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "completed_after_breach": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "active": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "rate": {
                    "type": "number"
                  }
                },
                "required": [
                  "fulfilled",
                  "breached",
                  "completed_after_breach",
                  "active",
                  "rate"
                ],
                "additionalProperties": false
              },
              "next_reply": {
                "type": "object",
                "properties": {
                  "fulfilled": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "breached": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "completed_after_breach": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "active": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "rate": {
                    "type": "number"
                  }
                },
                "required": [
                  "fulfilled",
                  "breached",
                  "completed_after_breach",
                  "active",
                  "rate"
                ],
                "additionalProperties": false
              },
              "resolution": {
                "type": "object",
                "properties": {
                  "fulfilled": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "breached": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "completed_after_breach": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "active": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "rate": {
                    "type": "number"
                  }
                },
                "required": [
                  "fulfilled",
                  "breached",
                  "completed_after_breach",
                  "active",
                  "rate"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "overall",
              "first_reply",
              "next_reply",
              "resolution"
            ],
            "additionalProperties": false
          },
          "percentiles": {
            "type": "object",
            "properties": {
              "first_reply": {
                "type": "object",
                "properties": {
                  "p50": {
                    "type": "number"
                  },
                  "p90": {
                    "type": "number"
                  },
                  "p95": {
                    "type": "number"
                  }
                },
                "required": [
                  "p50",
                  "p90",
                  "p95"
                ],
                "additionalProperties": false
              },
              "next_reply": {
                "type": "object",
                "properties": {
                  "p50": {
                    "type": "number"
                  },
                  "p90": {
                    "type": "number"
                  },
                  "p95": {
                    "type": "number"
                  }
                },
                "required": [
                  "p50",
                  "p90",
                  "p95"
                ],
                "additionalProperties": false
              },
              "resolution": {
                "type": "object",
                "properties": {
                  "p50": {
                    "type": "number"
                  },
                  "p90": {
                    "type": "number"
                  },
                  "p95": {
                    "type": "number"
                  }
                },
                "required": [
                  "p50",
                  "p90",
                  "p95"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "first_reply",
              "next_reply",
              "resolution"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "coverage_rate",
          "total_sessions",
          "sla_sessions",
          "compliance",
          "percentiles"
        ],
        "additionalProperties": false
      },
      "SlaBreakdownResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SlaBreakdownResponseDto",
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "grouping": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "policy",
                    "team",
                    "agent",
                    "channel"
                  ]
                },
                "id": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "number"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "name": {
                  "type": "string"
                }
              },
              "required": [
                "type",
                "id",
                "name"
              ],
              "additionalProperties": false
            },
            "sessions_count": {
              "type": "number"
            },
            "compliance": {
              "type": "object",
              "properties": {
                "overall": {
                  "type": "number"
                },
                "first_reply": {
                  "type": "object",
                  "properties": {
                    "fulfilled": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "breached": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "completed_after_breach": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "active": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "rate": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "fulfilled",
                    "breached",
                    "completed_after_breach",
                    "active",
                    "rate"
                  ],
                  "additionalProperties": false
                },
                "next_reply": {
                  "type": "object",
                  "properties": {
                    "fulfilled": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "breached": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "completed_after_breach": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "active": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "rate": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "fulfilled",
                    "breached",
                    "completed_after_breach",
                    "active",
                    "rate"
                  ],
                  "additionalProperties": false
                },
                "resolution": {
                  "type": "object",
                  "properties": {
                    "fulfilled": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "breached": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "completed_after_breach": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "active": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "rate": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "fulfilled",
                    "breached",
                    "completed_after_breach",
                    "active",
                    "rate"
                  ],
                  "additionalProperties": false
                }
              },
              "required": [
                "overall",
                "first_reply",
                "next_reply",
                "resolution"
              ],
              "additionalProperties": false
            },
            "percentiles": {
              "type": "object",
              "properties": {
                "first_reply": {
                  "type": "object",
                  "properties": {
                    "p50": {
                      "type": "number"
                    },
                    "p90": {
                      "type": "number"
                    },
                    "p95": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "p50",
                    "p90",
                    "p95"
                  ],
                  "additionalProperties": false
                },
                "next_reply": {
                  "type": "object",
                  "properties": {
                    "p50": {
                      "type": "number"
                    },
                    "p90": {
                      "type": "number"
                    },
                    "p95": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "p50",
                    "p90",
                    "p95"
                  ],
                  "additionalProperties": false
                },
                "resolution": {
                  "type": "object",
                  "properties": {
                    "p50": {
                      "type": "number"
                    },
                    "p90": {
                      "type": "number"
                    },
                    "p95": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "p50",
                    "p90",
                    "p95"
                  ],
                  "additionalProperties": false
                }
              },
              "required": [
                "first_reply",
                "next_reply",
                "resolution"
              ],
              "additionalProperties": false
            }
          },
          "required": [
            "grouping",
            "sessions_count",
            "compliance",
            "percentiles"
          ],
          "additionalProperties": false
        }
      },
      "SlaTrendResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SlaTrendResponseDto",
        "type": "object",
        "properties": {
          "granularity": {
            "type": "string",
            "enum": [
              "day",
              "week"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "date": {
                  "type": "string"
                },
                "sessions_count": {
                  "type": "number"
                },
                "compliance": {
                  "type": "object",
                  "properties": {
                    "overall": {
                      "type": "number"
                    },
                    "first_reply": {
                      "type": "object",
                      "properties": {
                        "fulfilled": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "breached": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "completed_after_breach": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "active": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "rate": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "fulfilled",
                        "breached",
                        "completed_after_breach",
                        "active",
                        "rate"
                      ],
                      "additionalProperties": false
                    },
                    "next_reply": {
                      "type": "object",
                      "properties": {
                        "fulfilled": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "breached": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "completed_after_breach": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "active": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "rate": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "fulfilled",
                        "breached",
                        "completed_after_breach",
                        "active",
                        "rate"
                      ],
                      "additionalProperties": false
                    },
                    "resolution": {
                      "type": "object",
                      "properties": {
                        "fulfilled": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "breached": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "completed_after_breach": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "active": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "rate": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "fulfilled",
                        "breached",
                        "completed_after_breach",
                        "active",
                        "rate"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "overall",
                    "first_reply",
                    "next_reply",
                    "resolution"
                  ],
                  "additionalProperties": false
                },
                "percentiles": {
                  "type": "object",
                  "properties": {
                    "first_reply": {
                      "type": "object",
                      "properties": {
                        "p50": {
                          "type": "number"
                        },
                        "p90": {
                          "type": "number"
                        },
                        "p95": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "p50",
                        "p90",
                        "p95"
                      ],
                      "additionalProperties": false
                    },
                    "next_reply": {
                      "type": "object",
                      "properties": {
                        "p50": {
                          "type": "number"
                        },
                        "p90": {
                          "type": "number"
                        },
                        "p95": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "p50",
                        "p90",
                        "p95"
                      ],
                      "additionalProperties": false
                    },
                    "resolution": {
                      "type": "object",
                      "properties": {
                        "p50": {
                          "type": "number"
                        },
                        "p90": {
                          "type": "number"
                        },
                        "p95": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "p50",
                        "p90",
                        "p95"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "first_reply",
                    "next_reply",
                    "resolution"
                  ],
                  "additionalProperties": false
                }
              },
              "required": [
                "date",
                "sessions_count",
                "compliance",
                "percentiles"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "granularity",
          "data"
        ],
        "additionalProperties": false
      },
      "SlaBreachHeatmapResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SlaBreachHeatmapResponseDto",
        "type": "object",
        "properties": {
          "timezone": {
            "type": "string"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "day_of_week": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 6
                },
                "hour": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 23
                },
                "breaches": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "day_of_week",
                "hour",
                "breaches"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "timezone",
          "data"
        ],
        "additionalProperties": false
      },
      "SavedReplyVariableDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SavedReplyVariableDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "org_id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "content": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "org_id",
          "name",
          "content",
          "created_at",
          "updated_at"
        ],
        "additionalProperties": false
      },
      "MacroSuggestionInsightsDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/MacroSuggestionInsightsDto",
        "type": "object",
        "properties": {
          "saved_reply_id": {
            "type": "string"
          },
          "window_days": {
            "type": "number",
            "const": 30
          },
          "state": {
            "type": "string",
            "enum": [
              "off",
              "learning",
              "proven",
              "steady",
              "muted"
            ]
          },
          "shown": {
            "type": "number"
          },
          "applied": {
            "type": "number"
          },
          "missed": {
            "type": "number"
          },
          "hit_rate": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "threshold": {
            "type": "number"
          },
          "weekly": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "week_start": {
                  "type": "string"
                },
                "shown": {
                  "type": "number"
                },
                "applied": {
                  "type": "number"
                },
                "missed": {
                  "type": "number"
                }
              },
              "required": [
                "week_start",
                "shown",
                "applied",
                "missed"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "saved_reply_id",
          "window_days",
          "state",
          "shown",
          "applied",
          "missed",
          "hit_rate",
          "threshold",
          "weekly"
        ],
        "additionalProperties": false
      },
      "MacroSuggestionInsightsListDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/MacroSuggestionInsightsListDto",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MacroSuggestionInsightsDto"
            }
          }
        },
        "required": [
          "items"
        ],
        "additionalProperties": false
      },
      "SavedReplyVariableEnum": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SavedReplyVariableEnum",
        "type": "string",
        "enum": [
          "agent.full_name",
          "agent.first_name",
          "agent.email",
          "contact.full_name",
          "contact.first_name",
          "contact.last_name",
          "contact.email",
          "contact.phone",
          "session.number",
          "session.status",
          "session.language",
          "org.name"
        ]
      },
      "SavedReplyVariablesResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SavedReplyVariablesResponseDto",
        "type": "object",
        "properties": {
          "enums": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SavedReplyVariableEnum"
            }
          },
          "custom": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SavedReplyVariableDto"
            }
          }
        },
        "required": [
          "enums",
          "custom"
        ],
        "additionalProperties": false
      },
      "SkipSequenceStepResponse": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SkipSequenceStepResponse",
        "type": "object",
        "properties": {
          "outcome": {
            "type": "string",
            "enum": [
              "skipped",
              "already_skipped",
              "contact_not_found",
              "not_skippable",
              "no_pending_step",
              "step_not_found",
              "step_not_pending",
              "dispatch_in_progress"
            ]
          },
          "skipped": {
            "type": "boolean",
            "description": "True only when this request newly skipped a step."
          },
          "contact_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "enrollment_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "step_index": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "channel": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "whatsapp",
                  "voice",
                  "email"
                ]
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "outcome",
          "skipped",
          "contact_id",
          "enrollment_id",
          "step_index",
          "channel"
        ],
        "additionalProperties": false
      },
      "SecretMetadataDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SecretMetadataDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "name": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "name",
          "created_at",
          "updated_at"
        ],
        "additionalProperties": false
      },
      "WhatsAppTemplateButtonOptionDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/WhatsAppTemplateButtonOptionDto",
        "type": "object",
        "properties": {
          "index": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Meta's 0-based button index — the key a step's `buttons` binding uses."
          },
          "type": {
            "type": "string",
            "enum": [
              "QUICK_REPLY",
              "URL",
              "PHONE_NUMBER",
              "COPY_CODE",
              "FLOW",
              "MPM"
            ]
          },
          "text": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The label. Null for a copy-code or product button."
          },
          "needs_value": {
            "type": "boolean",
            "description": "True for a URL button whose link ends in a placeholder (the suffix) and for a copy-code button (the coupon). Each such index needs a binding in the step content; the rest take none."
          }
        },
        "required": [
          "index",
          "type",
          "text",
          "needs_value"
        ],
        "additionalProperties": false
      },
      "WhatsAppTemplateOptionDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/WhatsAppTemplateOptionDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string",
            "description": "The value a sequence step's content.template_name takes."
          },
          "language": {
            "type": "string",
            "description": "The value a step's content.template_language takes."
          },
          "status": {
            "type": "string",
            "enum": [
              "APPROVED",
              "REJECTED",
              "PENDING",
              "PAUSED",
              "DISABLED",
              "IN_APPEAL",
              "PENDING_DELETION",
              "DELETED",
              "LIMIT_EXCEEDED",
              "ARCHIVED"
            ]
          },
          "category": {
            "type": "string",
            "enum": [
              "UTILITY",
              "MARKETING",
              "AUTHENTICATION"
            ]
          },
          "waba_id": {
            "type": "string"
          },
          "sendable": {
            "type": "boolean",
            "description": "True only for APPROVED. A sequence may reference a non-sendable template: one still in review does not block launch (sends wait until it clears), while a REJECTED/DISABLED one refuses the launch."
          },
          "body_text": {
            "type": "string",
            "description": "The message body as approved, placeholders intact."
          },
          "variables": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Placeholder keys in body order — [\"1\",\"2\"] positional, or names. Each needs a binding in the step content; an unbound one holds that person back rather than sending a gap."
          },
          "header_format": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "TEXT",
                  "IMAGE",
                  "DOCUMENT",
                  "VIDEO",
                  "LOCATION"
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "Null when the template has no header. Media headers need an asset to send."
          },
          "header_text": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "footer_text": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "buttons": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WhatsAppTemplateButtonOptionDto"
            }
          },
          "rejected_reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Why Meta rejected it, when it did. Null otherwise."
          }
        },
        "required": [
          "id",
          "name",
          "language",
          "status",
          "category",
          "waba_id",
          "sendable",
          "body_text",
          "variables",
          "header_format",
          "header_text",
          "footer_text",
          "buttons",
          "rejected_reason"
        ],
        "additionalProperties": false
      },
      "WhatsAppTemplateCatalogDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/WhatsAppTemplateCatalogDto",
        "type": "object",
        "properties": {
          "templates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WhatsAppTemplateOptionDto"
            }
          },
          "unreadable_wabas": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "waba_id": {
                  "type": "string"
                },
                "error": {
                  "type": "string"
                }
              },
              "required": [
                "waba_id",
                "error"
              ],
              "additionalProperties": false
            },
            "description": "WABAs whose template list could not be read. Their templates are MISSING from the list above, not absent from the org — do not author a duplicate on the strength of an empty result."
          }
        },
        "required": [
          "templates",
          "unreadable_wabas"
        ],
        "additionalProperties": false
      },
      "WhatsAppSenderDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/WhatsAppSenderDto",
        "type": "object",
        "properties": {
          "sender_id": {
            "type": "string",
            "description": "The WhatsApp phone number id — the value a sequence sender bind takes."
          },
          "waba_id": {
            "type": "string"
          },
          "display_phone_number": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "verified_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "quality_rating": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "sender_id",
          "waba_id",
          "display_phone_number",
          "verified_name",
          "quality_rating"
        ],
        "additionalProperties": false
      },
      "WhatsAppSendersDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/WhatsAppSendersDto",
        "type": "object",
        "properties": {
          "senders": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WhatsAppSenderDto"
            }
          }
        },
        "required": [
          "senders"
        ],
        "additionalProperties": false
      },
      "CreateWhatsAppTemplateDraftResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CreateWhatsAppTemplateDraftResponseDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "language": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "APPROVED",
              "REJECTED",
              "PENDING",
              "PAUSED",
              "DISABLED",
              "IN_APPEAL",
              "PENDING_DELETION",
              "DELETED",
              "LIMIT_EXCEEDED",
              "ARCHIVED"
            ]
          },
          "category": {
            "type": "string",
            "enum": [
              "UTILITY",
              "MARKETING",
              "AUTHENTICATION"
            ],
            "description": "What Meta FILED it as, which may differ from what was requested."
          },
          "variables": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "buttons": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WhatsAppTemplateButtonOptionDto"
            },
            "description": "Which indexes take a step binding — see needs_value."
          },
          "sendable": {
            "type": "boolean",
            "description": "Effectively always false on create: Meta review takes minutes to hours. Reference it from a step now — a pending template does not block launch; sends start the moment it clears."
          }
        },
        "required": [
          "id",
          "name",
          "language",
          "status",
          "category",
          "variables",
          "buttons",
          "sendable"
        ],
        "additionalProperties": false
      },
      "SequenceStepPersonalizationDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SequenceStepPersonalizationDto",
        "type": "object",
        "properties": {
          "step_index": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "content": {
            "anyOf": [
              {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "const": "email"
                      },
                      "subject": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 998
                      },
                      "html": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 65536
                      },
                      "text": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 65536
                      }
                    },
                    "required": [
                      "type",
                      "subject",
                      "html",
                      "text"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "const": "voice_call"
                      },
                      "extra_instructions": {
                        "anyOf": [
                          {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 10000
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "type",
                      "extra_instructions"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "const": "whatsapp_template"
                      },
                      "template_name": {
                        "type": "string",
                        "minLength": 1
                      },
                      "template_language": {
                        "type": "string",
                        "minLength": 1
                      },
                      "values": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string",
                          "pattern": "^[A-Za-z0-9_]+$"
                        },
                        "additionalProperties": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 1024
                        },
                        "description": "Literal body values keyed by positional index or exact parameter name; cover every body parameter with no extras."
                      }
                    },
                    "required": [
                      "type",
                      "template_name",
                      "template_language",
                      "values"
                    ],
                    "additionalProperties": false
                  }
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "edited_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "edited_by": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "stale": {
            "type": "boolean"
          },
          "unreadable": {
            "type": "boolean"
          }
        },
        "required": [
          "step_index",
          "content",
          "edited_at",
          "edited_by",
          "stale",
          "unreadable"
        ],
        "additionalProperties": false
      },
      "SetSequenceStepPersonalizationOutputDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SetSequenceStepPersonalizationOutputDto",
        "type": "object",
        "properties": {
          "personalization": {
            "$ref": "#/components/schemas/SequenceStepPersonalizationDto"
          },
          "unparked": {
            "type": "boolean"
          },
          "armed": {
            "type": "boolean"
          }
        },
        "required": [
          "personalization",
          "unparked",
          "armed"
        ],
        "additionalProperties": false
      },
      "ClearSequenceStepPersonalizationOutputDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ClearSequenceStepPersonalizationOutputDto",
        "type": "object",
        "properties": {
          "cleared": {
            "type": "boolean"
          }
        },
        "required": [
          "cleared"
        ],
        "additionalProperties": false
      },
      "SequenceStepPreviewDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SequenceStepPreviewDto",
        "type": "object",
        "properties": {
          "step_index": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "channel": {
            "type": "string",
            "enum": [
              "whatsapp",
              "voice",
              "email"
            ]
          },
          "source": {
            "type": "string",
            "enum": [
              "template",
              "personalized",
              "sent"
            ]
          },
          "stale_personalization": {
            "type": "boolean"
          },
          "sender_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "editable": {
            "type": "boolean"
          },
          "journey": {
            "type": "object",
            "properties": {
              "step_index": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "channel": {
                "type": "string"
              },
              "state": {
                "type": "string",
                "enum": [
                  "not_reached",
                  "waiting",
                  "parked",
                  "deferred",
                  "skipped",
                  "sent",
                  "delivered",
                  "read",
                  "replied",
                  "answered",
                  "no_answer",
                  "busy",
                  "failed"
                ]
              },
              "at": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "session_id": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "session_ticket_number": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "reason": {
                "type": "string"
              },
              "number_pool": {
                "description": "Progress within a phone step using a number pool. Absent for other steps; state remains the compatible overall step status.",
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "calling",
                      "retry_scheduled",
                      "answered",
                      "exhausted",
                      "paused",
                      "stopped"
                    ]
                  },
                  "attempts": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 3,
                    "description": "Number of call attempts started for this step."
                  },
                  "max_attempts": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 3
                  },
                  "caller_number": {
                    "description": "Caller number selected for the latest pool attempt. While waiting to retry, this remains the previous attempt’s number until the next attempt starts.",
                    "type": "string"
                  },
                  "next_retry_at": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Earliest time the next attempt can start; null when no retry is scheduled."
                  }
                },
                "required": [
                  "status",
                  "attempts",
                  "max_attempts",
                  "next_retry_at"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "step_index",
              "channel",
              "state",
              "at",
              "session_id",
              "session_ticket_number"
            ],
            "additionalProperties": false
          },
          "render": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "const": "rendered"
                  },
                  "content": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "email"
                          },
                          "subject": {
                            "type": "string"
                          },
                          "html": {
                            "type": "string"
                          },
                          "text": {
                            "type": "string"
                          },
                          "variables": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": "string"
                                },
                                "via": {
                                  "type": "string",
                                  "enum": [
                                    "data",
                                    "fallback"
                                  ]
                                }
                              },
                              "required": [
                                "value",
                                "via"
                              ],
                              "additionalProperties": false
                            },
                            "description": "Each substituted variable with its value and whether it came from the person's data or the binding's fallback. Empty when there is nothing to attribute: a personalization (a hand-written snapshot) or a send record (what went out, whole)."
                          }
                        },
                        "required": [
                          "type",
                          "subject",
                          "html",
                          "text",
                          "variables"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "voice_call"
                          },
                          "extra_instructions": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "variables": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {
                              "type": "object",
                              "properties": {
                                "value": {
                                  "type": "string"
                                },
                                "via": {
                                  "type": "string",
                                  "enum": [
                                    "data",
                                    "fallback"
                                  ]
                                }
                              },
                              "required": [
                                "value",
                                "via"
                              ],
                              "additionalProperties": false
                            },
                            "description": "Each substituted variable with its value and whether it came from the person's data or the binding's fallback. Empty when there is nothing to attribute: a personalization (a hand-written snapshot) or a send record (what went out, whole)."
                          }
                        },
                        "required": [
                          "type",
                          "extra_instructions",
                          "variables"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "whatsapp_template"
                          },
                          "template_name": {
                            "type": "string"
                          },
                          "template_language": {
                            "type": "string"
                          },
                          "values": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {
                              "type": "string"
                            }
                          },
                          "via": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {
                              "type": "string",
                              "enum": [
                                "data",
                                "fallback"
                              ]
                            }
                          },
                          "rendered_text": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "type",
                          "template_name",
                          "template_language",
                          "values",
                          "via",
                          "rendered_text"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  }
                },
                "required": [
                  "status",
                  "content"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "const": "needs_data"
                  },
                  "missing": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "status",
                  "missing"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "const": "unsendable_person"
                  },
                  "invalid": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "status",
                  "invalid"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "const": "too_long"
                  },
                  "length": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "max": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "status",
                  "length",
                  "max"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "const": "template_unavailable"
                  },
                  "detail": {
                    "type": "string"
                  }
                },
                "required": [
                  "status",
                  "detail"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "const": "send_record_unreadable"
                  }
                },
                "required": [
                  "status"
                ],
                "additionalProperties": false
              }
            ]
          }
        },
        "required": [
          "step_index",
          "channel",
          "source",
          "stale_personalization",
          "sender_id",
          "editable",
          "journey",
          "render"
        ],
        "additionalProperties": false
      },
      "ListSequenceContactsDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ListSequenceContactsDto",
        "type": "object",
        "properties": {
          "contacts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "contact_id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "display_name": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "avatar_url": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "phone": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "email": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "whatsapp_user_id": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "candidate",
                    "active",
                    "parked",
                    "exited",
                    "completed"
                  ]
                },
                "park_reason": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "exit_reason": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "fit": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "fit_reason": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "batch_key": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "source": {
                  "type": "string"
                },
                "next_step_index": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "qualification": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "run_id": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                        },
                        "judged_at": {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                        },
                        "input_hash": {
                          "type": "string"
                        },
                        "counts": {
                          "type": "object",
                          "properties": {
                            "must_total": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "must_passed": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "must_failed": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "must_unsure": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "nice_total": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "nice_weight_total": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "nice_weight_earned": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "nice_unsure": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "must_total",
                            "must_passed",
                            "must_failed",
                            "must_unsure",
                            "nice_total",
                            "nice_weight_total",
                            "nice_weight_earned",
                            "nice_unsure"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "run_id",
                        "judged_at",
                        "input_hash",
                        "counts"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "columns": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {}
                },
                "journey": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "step_index": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "channel": {
                        "type": "string"
                      },
                      "state": {
                        "type": "string",
                        "enum": [
                          "not_reached",
                          "waiting",
                          "parked",
                          "deferred",
                          "skipped",
                          "sent",
                          "delivered",
                          "read",
                          "replied",
                          "answered",
                          "no_answer",
                          "busy",
                          "failed"
                        ]
                      },
                      "at": {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "session_id": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "session_ticket_number": {
                        "anyOf": [
                          {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "reason": {
                        "type": "string"
                      },
                      "number_pool": {
                        "description": "Progress within a phone step using a number pool. Absent for other steps; state remains the compatible overall step status.",
                        "type": "object",
                        "properties": {
                          "status": {
                            "type": "string",
                            "enum": [
                              "calling",
                              "retry_scheduled",
                              "answered",
                              "exhausted",
                              "paused",
                              "stopped"
                            ]
                          },
                          "attempts": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 3,
                            "description": "Number of call attempts started for this step."
                          },
                          "max_attempts": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 3
                          },
                          "caller_number": {
                            "description": "Caller number selected for the latest pool attempt. While waiting to retry, this remains the previous attempt’s number until the next attempt starts.",
                            "type": "string"
                          },
                          "next_retry_at": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "Earliest time the next attempt can start; null when no retry is scheduled."
                          }
                        },
                        "required": [
                          "status",
                          "attempts",
                          "max_attempts",
                          "next_retry_at"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "required": [
                      "step_index",
                      "channel",
                      "state",
                      "at",
                      "session_id",
                      "session_ticket_number"
                    ],
                    "additionalProperties": false
                  }
                },
                "personalized_steps": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "created_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                },
                "updated_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                }
              },
              "required": [
                "contact_id",
                "display_name",
                "avatar_url",
                "phone",
                "email",
                "whatsapp_user_id",
                "status",
                "park_reason",
                "exit_reason",
                "fit",
                "fit_reason",
                "batch_key",
                "source",
                "next_step_index",
                "qualification",
                "columns",
                "journey",
                "personalized_steps",
                "created_at",
                "updated_at"
              ],
              "additionalProperties": false
            }
          },
          "next_cursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "total": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Total rows matching the filters (ignores pagination)."
          }
        },
        "required": [
          "contacts",
          "next_cursor",
          "total"
        ],
        "additionalProperties": false
      },
      "SequenceContactEventsDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SequenceContactEventsDto",
        "type": "object",
        "properties": {
          "events": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "step_index": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "event": {
                  "type": "string"
                },
                "event_data": {
                  "anyOf": [
                    {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                },
                "message_id": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "session_id": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "session_ticket_number": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "id",
                "step_index",
                "event",
                "event_data",
                "at",
                "message_id",
                "session_id",
                "session_ticket_number"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "events"
        ],
        "additionalProperties": false
      },
      "SequenceContactDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SequenceContactDto",
        "type": "object",
        "properties": {
          "contact_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "display_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "avatar_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "phone": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "whatsapp_user_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "candidate",
              "active",
              "parked",
              "exited",
              "completed"
            ]
          },
          "park_reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "exit_reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "fit": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "fit_reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "batch_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "source": {
            "type": "string"
          },
          "next_step_index": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "journey": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "step_index": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "channel": {
                  "type": "string"
                },
                "state": {
                  "type": "string",
                  "enum": [
                    "not_reached",
                    "waiting",
                    "parked",
                    "deferred",
                    "skipped",
                    "sent",
                    "delivered",
                    "read",
                    "replied",
                    "answered",
                    "no_answer",
                    "busy",
                    "failed"
                  ]
                },
                "at": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "session_id": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "session_ticket_number": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "reason": {
                  "type": "string"
                },
                "number_pool": {
                  "description": "Progress within a phone step using a number pool. Absent for other steps; state remains the compatible overall step status.",
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "enum": [
                        "calling",
                        "retry_scheduled",
                        "answered",
                        "exhausted",
                        "paused",
                        "stopped"
                      ]
                    },
                    "attempts": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 3,
                      "description": "Number of call attempts started for this step."
                    },
                    "max_attempts": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 3
                    },
                    "caller_number": {
                      "description": "Caller number selected for the latest pool attempt. While waiting to retry, this remains the previous attempt’s number until the next attempt starts.",
                      "type": "string"
                    },
                    "next_retry_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Earliest time the next attempt can start; null when no retry is scheduled."
                    }
                  },
                  "required": [
                    "status",
                    "attempts",
                    "max_attempts",
                    "next_retry_at"
                  ],
                  "additionalProperties": false
                }
              },
              "required": [
                "step_index",
                "channel",
                "state",
                "at",
                "session_id",
                "session_ticket_number"
              ],
              "additionalProperties": false
            }
          },
          "personalized_steps": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
          },
          "timezone": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "source_detail": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "qualification": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "run_id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  "judged_at": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                  },
                  "input_hash": {
                    "type": "string"
                  },
                  "criteria": {
                    "type": "object",
                    "properties": {
                      "must": {
                        "maxItems": 20,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "label": {
                              "type": "string",
                              "minLength": 2,
                              "maxLength": 60,
                              "description": "A few words naming this criterion, shown in the dashboard — \"Recent invoicing complaint\", \"Business account\". Not a sentence."
                            },
                            "text": {
                              "type": "string",
                              "minLength": 3,
                              "maxLength": 500,
                              "description": "The full instruction the judge reads. Name the boundary explicitly — what counts and what does not. Never shown in the table."
                            }
                          },
                          "required": [
                            "label",
                            "text"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "nice": {
                        "maxItems": 20,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "label": {
                              "type": "string",
                              "minLength": 2,
                              "maxLength": 60,
                              "description": "A few words naming this criterion, shown in the dashboard — \"Recent invoicing complaint\", \"Business account\". Not a sentence."
                            },
                            "text": {
                              "type": "string",
                              "minLength": 3,
                              "maxLength": 500,
                              "description": "The full instruction the judge reads. Name the boundary explicitly — what counts and what does not. Never shown in the table."
                            },
                            "grade": {
                              "type": "string",
                              "enum": [
                                "high",
                                "medium",
                                "low"
                              ]
                            }
                          },
                          "required": [
                            "label",
                            "text",
                            "grade"
                          ],
                          "additionalProperties": false
                        }
                      }
                    },
                    "required": [
                      "must",
                      "nice"
                    ],
                    "additionalProperties": false
                  },
                  "verdicts": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "must",
                            "nice"
                          ]
                        },
                        "label": {
                          "type": "string"
                        },
                        "text": {
                          "type": "string"
                        },
                        "grade": {
                          "type": "string",
                          "enum": [
                            "high",
                            "medium",
                            "low"
                          ]
                        },
                        "verdict": {
                          "type": "string",
                          "enum": [
                            "pass",
                            "fail",
                            "unsure"
                          ]
                        },
                        "reasoning": {
                          "type": "string"
                        },
                        "citations": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "enricher": {
                                "type": "string"
                              },
                              "kind": {
                                "type": "string"
                              },
                              "id": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "enricher",
                              "kind",
                              "id"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "kind",
                        "label",
                        "text",
                        "verdict",
                        "reasoning",
                        "citations"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "counts": {
                    "type": "object",
                    "properties": {
                      "must_total": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "must_passed": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "must_failed": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "must_unsure": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "nice_total": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "nice_weight_total": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "nice_weight_earned": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "nice_unsure": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "must_total",
                      "must_passed",
                      "must_failed",
                      "must_unsure",
                      "nice_total",
                      "nice_weight_total",
                      "nice_weight_earned",
                      "nice_unsure"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "run_id",
                  "judged_at",
                  "input_hash",
                  "criteria",
                  "verdicts",
                  "counts"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "enrichment": {
            "anyOf": [
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              },
              {
                "type": "null"
              }
            ]
          },
          "next_eligible_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "next_channel": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "personalizations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SequenceStepPersonalizationDto"
            }
          }
        },
        "required": [
          "contact_id",
          "display_name",
          "avatar_url",
          "phone",
          "email",
          "whatsapp_user_id",
          "status",
          "park_reason",
          "exit_reason",
          "fit",
          "fit_reason",
          "batch_key",
          "source",
          "next_step_index",
          "journey",
          "personalized_steps",
          "created_at",
          "updated_at",
          "timezone",
          "source_detail",
          "qualification",
          "enrichment",
          "next_eligible_at",
          "next_channel",
          "personalizations"
        ],
        "additionalProperties": false
      },
      "ExitSequenceContactOutputDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ExitSequenceContactOutputDto",
        "type": "object",
        "properties": {
          "outcome": {
            "type": "string",
            "enum": [
              "exited",
              "not_enrolled",
              "contact_not_found"
            ]
          },
          "contact_id": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "outcome",
          "contact_id"
        ],
        "additionalProperties": false
      },
      "IncludeSequenceContactDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/IncludeSequenceContactDto",
        "type": "object",
        "properties": {
          "contact_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "fit": {
            "type": "null"
          },
          "previous_fit": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "contact_id",
          "fit",
          "previous_fit"
        ],
        "additionalProperties": false
      },
      "ContinueSequenceContactOutputDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ContinueSequenceContactOutputDto",
        "type": "object",
        "properties": {
          "outcome": {
            "type": "string",
            "enum": [
              "resumed",
              "nothing_to_continue",
              "not_resumable",
              "contact_not_found"
            ]
          },
          "contact_id": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              {
                "type": "null"
              }
            ]
          },
          "next_step_index": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "outcome",
          "contact_id",
          "next_step_index"
        ],
        "additionalProperties": false
      },
      "ContactSequencesDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ContactSequencesDto",
        "type": "object",
        "properties": {
          "sequences": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "sequence_id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "sequence_name": {
                  "type": "string"
                },
                "sequence_status": {
                  "type": "string",
                  "enum": [
                    "draft",
                    "active",
                    "paused"
                  ]
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "candidate",
                    "active",
                    "parked",
                    "exited",
                    "completed"
                  ]
                },
                "exit_reason": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "replied",
                        "suppressed"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "park_reason": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "needs_data",
                        "unsendable_person",
                        "template_broken"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "next_step_index": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "enrolled_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                }
              },
              "required": [
                "sequence_id",
                "sequence_name",
                "sequence_status",
                "status",
                "exit_reason",
                "park_reason",
                "next_step_index",
                "enrolled_at"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "sequences"
        ],
        "additionalProperties": false
      },
      "MailboxHealthDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/MailboxHealthDto",
        "type": "object",
        "properties": {
          "warmupStatus": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "inboxRate": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "spamRate": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "healthScore": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "warmupTotalSent": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "warmingSince": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "hardBounceRate": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "recentSends": {
            "type": "number"
          },
          "checkedAt": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "warmupStatus",
          "inboxRate",
          "spamRate",
          "healthScore",
          "warmupTotalSent",
          "warmingSince",
          "hardBounceRate",
          "recentSends",
          "checkedAt"
        ],
        "additionalProperties": false
      },
      "QualificationRunDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/QualificationRunDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "campaign_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "type": {
            "type": "string",
            "enum": [
              "enrich",
              "judge"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "running",
              "completed",
              "failed"
            ]
          },
          "scope": {
            "anyOf": [
              {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "batch_key"
                      },
                      "batch_key": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      }
                    },
                    "required": [
                      "kind",
                      "batch_key"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "contact_ids"
                      },
                      "contact_ids": {
                        "minItems": 1,
                        "maxItems": 10000,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                        }
                      }
                    },
                    "required": [
                      "kind",
                      "contact_ids"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "all_candidates"
                      }
                    },
                    "required": [
                      "kind"
                    ],
                    "additionalProperties": false
                  }
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "criteria": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "must": {
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "label": {
                          "type": "string",
                          "minLength": 2,
                          "maxLength": 60,
                          "description": "A few words naming this criterion, shown in the dashboard — \"Recent invoicing complaint\", \"Business account\". Not a sentence."
                        },
                        "text": {
                          "type": "string",
                          "minLength": 3,
                          "maxLength": 500,
                          "description": "The full instruction the judge reads. Name the boundary explicitly — what counts and what does not. Never shown in the table."
                        }
                      },
                      "required": [
                        "label",
                        "text"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "nice": {
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "label": {
                          "type": "string",
                          "minLength": 2,
                          "maxLength": 60,
                          "description": "A few words naming this criterion, shown in the dashboard — \"Recent invoicing complaint\", \"Business account\". Not a sentence."
                        },
                        "text": {
                          "type": "string",
                          "minLength": 3,
                          "maxLength": 500,
                          "description": "The full instruction the judge reads. Name the boundary explicitly — what counts and what does not. Never shown in the table."
                        },
                        "grade": {
                          "type": "string",
                          "enum": [
                            "high",
                            "medium",
                            "low"
                          ]
                        }
                      },
                      "required": [
                        "label",
                        "text",
                        "grade"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "must",
                  "nice"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "enrichers": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "opencx"
                  ]
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "model": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "counts": {
            "type": "object",
            "properties": {
              "scoped": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "processed": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "no_data": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "skipped_no_enrichment": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "skipped_unchanged": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "qualified": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "disqualified": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "errors": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "scoped",
              "processed",
              "no_data",
              "skipped_no_enrichment",
              "skipped_unchanged",
              "qualified",
              "disqualified",
              "errors"
            ],
            "additionalProperties": false
          },
          "aggregates": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "criteria": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "must",
                            "nice"
                          ]
                        },
                        "text": {
                          "type": "string"
                        },
                        "pass": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "fail": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "unsure": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "kind",
                        "text",
                        "pass",
                        "fail",
                        "unsure"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "fit_distribution": {
                    "type": "object",
                    "properties": {
                      "qualified": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "not_qualified": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "near_miss": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "qualified",
                      "not_qualified",
                      "near_miss"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "criteria",
                  "fit_distribution"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
          },
          "started_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "completed_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
          }
        },
        "required": [
          "id",
          "campaign_id",
          "type",
          "status",
          "scope",
          "criteria",
          "enrichers",
          "model",
          "counts",
          "aggregates",
          "error",
          "created_at",
          "started_at",
          "completed_at",
          "updated_at"
        ],
        "additionalProperties": false
      },
      "QualificationRunAckDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/QualificationRunAckDto",
        "type": "object",
        "properties": {
          "run_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "scoped_count": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "run": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/QualificationRunDto"
              },
              {
                "type": "null"
              }
            ],
            "description": "The finished run (counts + aggregates) when `wait` was set, the scope was small enough, and it settled in time. Null otherwise — read it with read_qualification_run."
          }
        },
        "required": [
          "run_id",
          "scoped_count",
          "run"
        ],
        "additionalProperties": false
      },
      "ListQualificationRunsDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ListQualificationRunsDto",
        "type": "object",
        "properties": {
          "runs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/QualificationRunDto"
            }
          }
        },
        "required": [
          "runs"
        ],
        "additionalProperties": false
      },
      "SequenceDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SequenceDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "org_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "active",
              "paused"
            ]
          },
          "paused_reason": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "trunk_missing",
                  "caller_id_missing",
                  "team_missing",
                  "telephony_off",
                  "calls_failing"
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "Set when the sequence paused itself: \"trunk_missing\" (a Human voice step's SIP trunk was deleted), \"caller_id_missing\" (its caller ID is no longer one of the workspace's verified numbers), \"team_missing\" (its team was deleted), \"telephony_off\" (telephony was turned off for the workspace) or \"calls_failing\" (most of its latest team calls failed). null when a person paused it or it is not paused. Resuming clears it."
          },
          "steps": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "channel": {
                      "type": "string",
                      "const": "whatsapp"
                    },
                    "content": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "whatsapp_template"
                        },
                        "template_name": {
                          "type": "string",
                          "minLength": 1
                        },
                        "template_language": {
                          "type": "string",
                          "minLength": 1
                        },
                        "variables": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "object",
                            "properties": {
                              "source": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200,
                                "description": "A recipient column ('display_name', 'phone', 'email') or the exact name of a key in the person's attached data (extra_data). Those three names always read the column — a key spelled the same is unreachable; any other string reads the attached data, matched verbatim as a top-level key. A missing or empty value falls to `fallback`, and with no fallback the person parks (needs_data)."
                              },
                              "fallback": {
                                "type": "string"
                              },
                              "type": {
                                "description": "Optional. Applies to attached-data sources only — ignored on the three columns. How to read the value: string, number, boolean, date, string[] or number[] — the same vocabulary as People-table columns. Absent: text and numbers pass through, anything else counts as missing. Declared: text is parsed where it is unambiguous (\"250\" as a number or a string, \"true\" as a boolean, an ISO-shaped date such as \"2026-03-12\" — other date spellings and epoch numbers are missing), a date renders as a plain day in the person's timezone, a list needs an actual list in the data and joins with commas, dropping items it cannot read, and a value that cannot be read as the declared type counts as missing.",
                                "type": "string",
                                "enum": [
                                  "string",
                                  "number",
                                  "boolean",
                                  "date",
                                  "string[]",
                                  "number[]"
                                ]
                              }
                            },
                            "required": [
                              "source"
                            ],
                            "additionalProperties": false
                          },
                          "description": "Body bindings keyed by positional index (\"1\", \"2\") or exact parameter name (\"first_name\")."
                        },
                        "buttons": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string",
                            "pattern": "^[0-9]$"
                          },
                          "additionalProperties": {
                            "type": "object",
                            "properties": {
                              "source": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200,
                                "description": "A recipient column ('display_name', 'phone', 'email') or the exact name of a key in the person's attached data (extra_data). Those three names always read the column — a key spelled the same is unreachable; any other string reads the attached data, matched verbatim as a top-level key. A missing or empty value falls to `fallback`, and with no fallback the person parks (needs_data)."
                              },
                              "fallback": {
                                "type": "string"
                              },
                              "type": {
                                "description": "Optional. Applies to attached-data sources only — ignored on the three columns. How to read the value: string, number, boolean, date, string[] or number[] — the same vocabulary as People-table columns. Absent: text and numbers pass through, anything else counts as missing. Declared: text is parsed where it is unambiguous (\"250\" as a number or a string, \"true\" as a boolean, an ISO-shaped date such as \"2026-03-12\" — other date spellings and epoch numbers are missing), a date renders as a plain day in the person's timezone, a list needs an actual list in the data and joins with commas, dropping items it cannot read, and a value that cannot be read as the declared type counts as missing.",
                                "type": "string",
                                "enum": [
                                  "string",
                                  "number",
                                  "boolean",
                                  "date",
                                  "string[]",
                                  "number[]"
                                ]
                              }
                            },
                            "required": [
                              "source"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "type",
                        "template_name",
                        "template_language",
                        "variables"
                      ],
                      "additionalProperties": false
                    },
                    "delay_minutes": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 129600
                    }
                  },
                  "required": [
                    "channel",
                    "content",
                    "delay_minutes"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "channel": {
                      "type": "string",
                      "const": "voice"
                    },
                    "content": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "voice_call"
                        },
                        "extra_instructions": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 8000
                        },
                        "variables": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 64
                          },
                          "additionalProperties": {
                            "type": "object",
                            "properties": {
                              "source": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200,
                                "description": "A recipient column ('display_name', 'phone', 'email') or the exact name of a key in the person's attached data (extra_data). Those three names always read the column — a key spelled the same is unreachable; any other string reads the attached data, matched verbatim as a top-level key. A missing or empty value falls to `fallback`, and with no fallback the person parks (needs_data)."
                              },
                              "fallback": {
                                "type": "string"
                              },
                              "type": {
                                "description": "Optional. Applies to attached-data sources only — ignored on the three columns. How to read the value: string, number, boolean, date, string[] or number[] — the same vocabulary as People-table columns. Absent: text and numbers pass through, anything else counts as missing. Declared: text is parsed where it is unambiguous (\"250\" as a number or a string, \"true\" as a boolean, an ISO-shaped date such as \"2026-03-12\" — other date spellings and epoch numbers are missing), a date renders as a plain day in the person's timezone, a list needs an actual list in the data and joins with commas, dropping items it cannot read, and a value that cannot be read as the declared type counts as missing.",
                                "type": "string",
                                "enum": [
                                  "string",
                                  "number",
                                  "boolean",
                                  "date",
                                  "string[]",
                                  "number[]"
                                ]
                              }
                            },
                            "required": [
                              "source"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "handled_by": {
                          "description": "Who takes the call: \"ai\" (default) — the sequence's AI phone agent; \"human\" — a team of agents, dialed for them through the org's own SIP trunk. Omitted = \"ai\", except on an update of a human step, which must say \"ai\" to switch it.",
                          "type": "string",
                          "enum": [
                            "ai",
                            "human"
                          ]
                        },
                        "team_id": {
                          "description": "Human steps: the team whose free agents take the calls. Required when handled_by is \"human\".",
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "trunk_id": {
                          "description": "Human steps: the org's own SIP trunk the calls go out through (see list voice trunks). Required when handled_by is \"human\".",
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                        },
                        "caller_id": {
                          "description": "Human steps: the number shown to the person, in E.164 (+ and digits), one of the workspace's verified numbers. Omitted = the trunk's default.",
                          "type": "string",
                          "pattern": "^\\+[1-9]\\d{6,14}$"
                        },
                        "numbers_per_free_agent": {
                          "description": "Human steps: how many numbers ring at once for each free agent (1–5, default 1). Above 1, a person who picks up while every agent is busy is missed and gets the next step.",
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 5
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false
                    },
                    "delay_minutes": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 129600
                    }
                  },
                  "required": [
                    "channel",
                    "content",
                    "delay_minutes"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "channel": {
                      "type": "string",
                      "const": "email"
                    },
                    "content": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "email"
                        },
                        "subject": {
                          "type": "string",
                          "minLength": 1
                        },
                        "html": {
                          "type": "string",
                          "minLength": 1
                        },
                        "text": {
                          "type": "string",
                          "minLength": 1
                        },
                        "variables": {
                          "default": {},
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "object",
                            "properties": {
                              "source": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200,
                                "description": "A recipient column ('display_name', 'phone', 'email') or the exact name of a key in the person's attached data (extra_data). Those three names always read the column — a key spelled the same is unreachable; any other string reads the attached data, matched verbatim as a top-level key. A missing or empty value falls to `fallback`, and with no fallback the person parks (needs_data)."
                              },
                              "fallback": {
                                "type": "string"
                              },
                              "type": {
                                "description": "Optional. Applies to attached-data sources only — ignored on the three columns. How to read the value: string, number, boolean, date, string[] or number[] — the same vocabulary as People-table columns. Absent: text and numbers pass through, anything else counts as missing. Declared: text is parsed where it is unambiguous (\"250\" as a number or a string, \"true\" as a boolean, an ISO-shaped date such as \"2026-03-12\" — other date spellings and epoch numbers are missing), a date renders as a plain day in the person's timezone, a list needs an actual list in the data and joins with commas, dropping items it cannot read, and a value that cannot be read as the declared type counts as missing.",
                                "type": "string",
                                "enum": [
                                  "string",
                                  "number",
                                  "boolean",
                                  "date",
                                  "string[]",
                                  "number[]"
                                ]
                              }
                            },
                            "required": [
                              "source"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "type",
                        "subject",
                        "html",
                        "text",
                        "variables"
                      ],
                      "additionalProperties": false
                    },
                    "delay_minutes": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 129600
                    }
                  },
                  "required": [
                    "channel",
                    "content",
                    "delay_minutes"
                  ],
                  "additionalProperties": false
                }
              ]
            }
          },
          "settings": {
            "type": "object",
            "properties": {
              "block_active_elsewhere": {
                "type": "boolean"
              },
              "block_contacted_before": {
                "type": "boolean"
              },
              "respect_office_hours": {
                "type": "boolean"
              },
              "office_hours_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              }
            },
            "additionalProperties": false
          },
          "brief": {
            "type": "string"
          },
          "reply_instructions": {
            "type": "string"
          },
          "criteria": {
            "type": "object",
            "properties": {
              "must": {
                "maxItems": 20,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "label": {
                      "type": "string",
                      "minLength": 2,
                      "maxLength": 60,
                      "description": "A few words naming this criterion, shown in the dashboard — \"Recent invoicing complaint\", \"Business account\". Not a sentence."
                    },
                    "text": {
                      "type": "string",
                      "minLength": 3,
                      "maxLength": 500,
                      "description": "The full instruction the judge reads. Name the boundary explicitly — what counts and what does not. Never shown in the table."
                    }
                  },
                  "required": [
                    "label",
                    "text"
                  ],
                  "additionalProperties": false
                }
              },
              "nice": {
                "maxItems": 20,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "label": {
                      "type": "string",
                      "minLength": 2,
                      "maxLength": 60,
                      "description": "A few words naming this criterion, shown in the dashboard — \"Recent invoicing complaint\", \"Business account\". Not a sentence."
                    },
                    "text": {
                      "type": "string",
                      "minLength": 3,
                      "maxLength": 500,
                      "description": "The full instruction the judge reads. Name the boundary explicitly — what counts and what does not. Never shown in the table."
                    },
                    "grade": {
                      "type": "string",
                      "enum": [
                        "high",
                        "medium",
                        "low"
                      ]
                    }
                  },
                  "required": [
                    "label",
                    "text",
                    "grade"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "must",
              "nice"
            ],
            "additionalProperties": false
          },
          "columns": {
            "maxItems": 12,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 59,
                  "pattern": "^[a-z0-9_]+$"
                },
                "label": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 60
                },
                "path": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 300
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "string",
                    "number",
                    "boolean",
                    "date",
                    "string[]",
                    "number[]"
                  ]
                }
              },
              "required": [
                "key",
                "label",
                "path",
                "type"
              ],
              "additionalProperties": false
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "deleted_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "org_id",
          "name",
          "status",
          "paused_reason",
          "steps",
          "settings",
          "brief",
          "reply_instructions",
          "criteria",
          "columns",
          "created_at",
          "updated_at",
          "deleted_at"
        ],
        "additionalProperties": false
      },
      "SequenceListItemDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SequenceListItemDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "org_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "active",
              "paused"
            ]
          },
          "paused_reason": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "trunk_missing",
                  "caller_id_missing",
                  "team_missing",
                  "telephony_off",
                  "calls_failing"
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "Set when the sequence paused itself: \"trunk_missing\" (a Human voice step's SIP trunk was deleted), \"caller_id_missing\" (its caller ID is no longer one of the workspace's verified numbers), \"team_missing\" (its team was deleted), \"telephony_off\" (telephony was turned off for the workspace) or \"calls_failing\" (most of its latest team calls failed). null when a person paused it or it is not paused. Resuming clears it."
          },
          "steps": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "channel": {
                      "type": "string",
                      "const": "whatsapp"
                    },
                    "content": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "whatsapp_template"
                        },
                        "template_name": {
                          "type": "string",
                          "minLength": 1
                        },
                        "template_language": {
                          "type": "string",
                          "minLength": 1
                        },
                        "variables": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "object",
                            "properties": {
                              "source": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200,
                                "description": "A recipient column ('display_name', 'phone', 'email') or the exact name of a key in the person's attached data (extra_data). Those three names always read the column — a key spelled the same is unreachable; any other string reads the attached data, matched verbatim as a top-level key. A missing or empty value falls to `fallback`, and with no fallback the person parks (needs_data)."
                              },
                              "fallback": {
                                "type": "string"
                              },
                              "type": {
                                "description": "Optional. Applies to attached-data sources only — ignored on the three columns. How to read the value: string, number, boolean, date, string[] or number[] — the same vocabulary as People-table columns. Absent: text and numbers pass through, anything else counts as missing. Declared: text is parsed where it is unambiguous (\"250\" as a number or a string, \"true\" as a boolean, an ISO-shaped date such as \"2026-03-12\" — other date spellings and epoch numbers are missing), a date renders as a plain day in the person's timezone, a list needs an actual list in the data and joins with commas, dropping items it cannot read, and a value that cannot be read as the declared type counts as missing.",
                                "type": "string",
                                "enum": [
                                  "string",
                                  "number",
                                  "boolean",
                                  "date",
                                  "string[]",
                                  "number[]"
                                ]
                              }
                            },
                            "required": [
                              "source"
                            ],
                            "additionalProperties": false
                          },
                          "description": "Body bindings keyed by positional index (\"1\", \"2\") or exact parameter name (\"first_name\")."
                        },
                        "buttons": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string",
                            "pattern": "^[0-9]$"
                          },
                          "additionalProperties": {
                            "type": "object",
                            "properties": {
                              "source": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200,
                                "description": "A recipient column ('display_name', 'phone', 'email') or the exact name of a key in the person's attached data (extra_data). Those three names always read the column — a key spelled the same is unreachable; any other string reads the attached data, matched verbatim as a top-level key. A missing or empty value falls to `fallback`, and with no fallback the person parks (needs_data)."
                              },
                              "fallback": {
                                "type": "string"
                              },
                              "type": {
                                "description": "Optional. Applies to attached-data sources only — ignored on the three columns. How to read the value: string, number, boolean, date, string[] or number[] — the same vocabulary as People-table columns. Absent: text and numbers pass through, anything else counts as missing. Declared: text is parsed where it is unambiguous (\"250\" as a number or a string, \"true\" as a boolean, an ISO-shaped date such as \"2026-03-12\" — other date spellings and epoch numbers are missing), a date renders as a plain day in the person's timezone, a list needs an actual list in the data and joins with commas, dropping items it cannot read, and a value that cannot be read as the declared type counts as missing.",
                                "type": "string",
                                "enum": [
                                  "string",
                                  "number",
                                  "boolean",
                                  "date",
                                  "string[]",
                                  "number[]"
                                ]
                              }
                            },
                            "required": [
                              "source"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "type",
                        "template_name",
                        "template_language",
                        "variables"
                      ],
                      "additionalProperties": false
                    },
                    "delay_minutes": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 129600
                    }
                  },
                  "required": [
                    "channel",
                    "content",
                    "delay_minutes"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "channel": {
                      "type": "string",
                      "const": "voice"
                    },
                    "content": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "voice_call"
                        },
                        "extra_instructions": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 8000
                        },
                        "variables": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 64
                          },
                          "additionalProperties": {
                            "type": "object",
                            "properties": {
                              "source": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200,
                                "description": "A recipient column ('display_name', 'phone', 'email') or the exact name of a key in the person's attached data (extra_data). Those three names always read the column — a key spelled the same is unreachable; any other string reads the attached data, matched verbatim as a top-level key. A missing or empty value falls to `fallback`, and with no fallback the person parks (needs_data)."
                              },
                              "fallback": {
                                "type": "string"
                              },
                              "type": {
                                "description": "Optional. Applies to attached-data sources only — ignored on the three columns. How to read the value: string, number, boolean, date, string[] or number[] — the same vocabulary as People-table columns. Absent: text and numbers pass through, anything else counts as missing. Declared: text is parsed where it is unambiguous (\"250\" as a number or a string, \"true\" as a boolean, an ISO-shaped date such as \"2026-03-12\" — other date spellings and epoch numbers are missing), a date renders as a plain day in the person's timezone, a list needs an actual list in the data and joins with commas, dropping items it cannot read, and a value that cannot be read as the declared type counts as missing.",
                                "type": "string",
                                "enum": [
                                  "string",
                                  "number",
                                  "boolean",
                                  "date",
                                  "string[]",
                                  "number[]"
                                ]
                              }
                            },
                            "required": [
                              "source"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "handled_by": {
                          "description": "Who takes the call: \"ai\" (default) — the sequence's AI phone agent; \"human\" — a team of agents, dialed for them through the org's own SIP trunk. Omitted = \"ai\", except on an update of a human step, which must say \"ai\" to switch it.",
                          "type": "string",
                          "enum": [
                            "ai",
                            "human"
                          ]
                        },
                        "team_id": {
                          "description": "Human steps: the team whose free agents take the calls. Required when handled_by is \"human\".",
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "trunk_id": {
                          "description": "Human steps: the org's own SIP trunk the calls go out through (see list voice trunks). Required when handled_by is \"human\".",
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                        },
                        "caller_id": {
                          "description": "Human steps: the number shown to the person, in E.164 (+ and digits), one of the workspace's verified numbers. Omitted = the trunk's default.",
                          "type": "string",
                          "pattern": "^\\+[1-9]\\d{6,14}$"
                        },
                        "numbers_per_free_agent": {
                          "description": "Human steps: how many numbers ring at once for each free agent (1–5, default 1). Above 1, a person who picks up while every agent is busy is missed and gets the next step.",
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 5
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false
                    },
                    "delay_minutes": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 129600
                    }
                  },
                  "required": [
                    "channel",
                    "content",
                    "delay_minutes"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "channel": {
                      "type": "string",
                      "const": "email"
                    },
                    "content": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "email"
                        },
                        "subject": {
                          "type": "string",
                          "minLength": 1
                        },
                        "html": {
                          "type": "string",
                          "minLength": 1
                        },
                        "text": {
                          "type": "string",
                          "minLength": 1
                        },
                        "variables": {
                          "default": {},
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "object",
                            "properties": {
                              "source": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200,
                                "description": "A recipient column ('display_name', 'phone', 'email') or the exact name of a key in the person's attached data (extra_data). Those three names always read the column — a key spelled the same is unreachable; any other string reads the attached data, matched verbatim as a top-level key. A missing or empty value falls to `fallback`, and with no fallback the person parks (needs_data)."
                              },
                              "fallback": {
                                "type": "string"
                              },
                              "type": {
                                "description": "Optional. Applies to attached-data sources only — ignored on the three columns. How to read the value: string, number, boolean, date, string[] or number[] — the same vocabulary as People-table columns. Absent: text and numbers pass through, anything else counts as missing. Declared: text is parsed where it is unambiguous (\"250\" as a number or a string, \"true\" as a boolean, an ISO-shaped date such as \"2026-03-12\" — other date spellings and epoch numbers are missing), a date renders as a plain day in the person's timezone, a list needs an actual list in the data and joins with commas, dropping items it cannot read, and a value that cannot be read as the declared type counts as missing.",
                                "type": "string",
                                "enum": [
                                  "string",
                                  "number",
                                  "boolean",
                                  "date",
                                  "string[]",
                                  "number[]"
                                ]
                              }
                            },
                            "required": [
                              "source"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "type",
                        "subject",
                        "html",
                        "text",
                        "variables"
                      ],
                      "additionalProperties": false
                    },
                    "delay_minutes": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 129600
                    }
                  },
                  "required": [
                    "channel",
                    "content",
                    "delay_minutes"
                  ],
                  "additionalProperties": false
                }
              ]
            }
          },
          "settings": {
            "type": "object",
            "properties": {
              "block_active_elsewhere": {
                "type": "boolean"
              },
              "block_contacted_before": {
                "type": "boolean"
              },
              "respect_office_hours": {
                "type": "boolean"
              },
              "office_hours_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              }
            },
            "additionalProperties": false
          },
          "brief": {
            "type": "string"
          },
          "reply_instructions": {
            "type": "string"
          },
          "criteria": {
            "type": "object",
            "properties": {
              "must": {
                "maxItems": 20,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "label": {
                      "type": "string",
                      "minLength": 2,
                      "maxLength": 60,
                      "description": "A few words naming this criterion, shown in the dashboard — \"Recent invoicing complaint\", \"Business account\". Not a sentence."
                    },
                    "text": {
                      "type": "string",
                      "minLength": 3,
                      "maxLength": 500,
                      "description": "The full instruction the judge reads. Name the boundary explicitly — what counts and what does not. Never shown in the table."
                    }
                  },
                  "required": [
                    "label",
                    "text"
                  ],
                  "additionalProperties": false
                }
              },
              "nice": {
                "maxItems": 20,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "label": {
                      "type": "string",
                      "minLength": 2,
                      "maxLength": 60,
                      "description": "A few words naming this criterion, shown in the dashboard — \"Recent invoicing complaint\", \"Business account\". Not a sentence."
                    },
                    "text": {
                      "type": "string",
                      "minLength": 3,
                      "maxLength": 500,
                      "description": "The full instruction the judge reads. Name the boundary explicitly — what counts and what does not. Never shown in the table."
                    },
                    "grade": {
                      "type": "string",
                      "enum": [
                        "high",
                        "medium",
                        "low"
                      ]
                    }
                  },
                  "required": [
                    "label",
                    "text",
                    "grade"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "must",
              "nice"
            ],
            "additionalProperties": false
          },
          "columns": {
            "maxItems": 12,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 59,
                  "pattern": "^[a-z0-9_]+$"
                },
                "label": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 60
                },
                "path": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 300
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "string",
                    "number",
                    "boolean",
                    "date",
                    "string[]",
                    "number[]"
                  ]
                }
              },
              "required": [
                "key",
                "label",
                "path",
                "type"
              ],
              "additionalProperties": false
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "deleted_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "stats": {
            "type": "object",
            "properties": {
              "people": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991,
                "description": "Everyone this sequence is for: enrolled minus the people the judge turned down. Not scoped to a status — someone who replied, finished or opted out was still part of the audience. Always equals will_send + might_send."
              },
              "will_send": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991,
                "description": "The JUDGED half of `people`, not \"everyone here passed\": those who cleared the arming floor, plus anyone a later run scored below it after we had already armed or messaged them — a verdict cannot un-send a message. Before launch the two readings coincide, which is the only place this is shown as \"will send to\"; afterwards read `in_flight` for what can still happen."
              },
              "might_send": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991,
                "description": "Never judged. These arm too — an unjudged list is user authority. For a sequence that has not launched, the audience it would send to is will_send + might_send; once it has, some of those people are already done and `in_flight` is the forward-looking number."
              },
              "rejected": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991,
                "description": "Judged and turned down BEFORE anything was sent — the exact complement of `people`, so the two are `enrolled`. Someone already armed when a later run failed them is not here; they stay in the audience."
              },
              "enrolled": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991,
                "description": "The whole list, judged-down included — people + rejected."
              },
              "has_criteria": {
                "type": "boolean",
                "description": "Whether there is anything for the judge to work against. Decides whether the audience has a split worth showing at all."
              },
              "sent": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "replied": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "wont_reach": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991,
                "description": "Concluded without ever being reached — journey over, nothing sent. Terminal only: parked people and deferrals are excluded, since neither is a conclusion. people = sent + wont_reach + (in flight and never contacted) — someone mid-sequence has been contacted AND is still in flight, so the plain three-term form double counts them."
              },
              "needs_you": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991,
                "description": "Parked: waiting on a human to fix something, after which the journey resumes where it stopped. Kept apart from wont_reach because it is a call to action, not attrition. A SLICE of the still-in-flight people, not a fourth bucket beside them — someone parked after step 0 is counted here and in `sent`, so do not add this to the others."
              },
              "finished": {
                "type": "boolean",
                "description": "Nothing left in flight and something already went out. Derived, never stored — the status stays `active`, so enrolling more people revives the sequence on its own."
              },
              "busy": {
                "type": "boolean",
                "description": "An enrich or judge run is in flight for this sequence."
              }
            },
            "required": [
              "people",
              "will_send",
              "might_send",
              "rejected",
              "enrolled",
              "has_criteria",
              "sent",
              "replied",
              "wont_reach",
              "needs_you",
              "finished",
              "busy"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "id",
          "org_id",
          "name",
          "status",
          "paused_reason",
          "steps",
          "settings",
          "brief",
          "reply_instructions",
          "criteria",
          "columns",
          "created_at",
          "updated_at",
          "deleted_at",
          "stats"
        ],
        "additionalProperties": false
      },
      "ListSequencesDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ListSequencesDto",
        "type": "object",
        "properties": {
          "sequences": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SequenceListItemDto"
            }
          }
        },
        "required": [
          "sequences"
        ],
        "additionalProperties": false
      },
      "SequenceRepliesDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SequenceRepliesDto",
        "type": "object",
        "properties": {
          "replies": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "session_id": {
                  "type": "string",
                  "description": "The inbox session this reply started."
                },
                "ticket_number": {
                  "type": "number",
                  "description": "What the inbox routes on."
                },
                "contact_id": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "contact_name": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Null when the contact row is gone or simply unnamed."
                },
                "contact_avatar_url": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "step_index": {
                  "anyOf": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Which step they answered; null when the stamp carried no usable one."
                },
                "preview": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "The opening line of what they said, truncated. Null when the caller may not read transcripts (needs the sessions capability / chat-sessions scope), or when the reply carried no text at all."
                },
                "at": {
                  "type": "string",
                  "description": "When they answered (ISO 8601)."
                }
              },
              "required": [
                "session_id",
                "ticket_number",
                "contact_id",
                "contact_name",
                "contact_avatar_url",
                "step_index",
                "preview",
                "at"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "replies"
        ],
        "additionalProperties": false
      },
      "SequenceStatsDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SequenceStatsDto",
        "type": "object",
        "properties": {
          "people": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Everyone this sequence is for: enrolled minus the people the judge turned down. Not scoped to a status — someone who replied, finished or opted out was still part of the audience. Always equals will_send + might_send."
          },
          "will_send": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "The JUDGED half of `people`, not \"everyone here passed\": those who cleared the arming floor, plus anyone a later run scored below it after we had already armed or messaged them — a verdict cannot un-send a message. Before launch the two readings coincide, which is the only place this is shown as \"will send to\"; afterwards read `in_flight` for what can still happen."
          },
          "might_send": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Never judged. These arm too — an unjudged list is user authority. For a sequence that has not launched, the audience it would send to is will_send + might_send; once it has, some of those people are already done and `in_flight` is the forward-looking number."
          },
          "rejected": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Judged and turned down BEFORE anything was sent — the exact complement of `people`, so the two are `enrolled`. Someone already armed when a later run failed them is not here; they stay in the audience."
          },
          "enrolled": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "The whole list, judged-down included — people + rejected."
          },
          "has_criteria": {
            "type": "boolean",
            "description": "Whether there is anything for the judge to work against. Decides whether the audience has a split worth showing at all."
          },
          "sent": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "replied": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "wont_reach": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Concluded without ever being reached — journey over, nothing sent. Terminal only: parked people and deferrals are excluded, since neither is a conclusion. people = sent + wont_reach + (in flight and never contacted) — someone mid-sequence has been contacted AND is still in flight, so the plain three-term form double counts them."
          },
          "needs_you": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Parked: waiting on a human to fix something, after which the journey resumes where it stopped. Kept apart from wont_reach because it is a call to action, not attrition. A SLICE of the still-in-flight people, not a fourth bucket beside them — someone parked after step 0 is counted here and in `sent`, so do not add this to the others."
          },
          "finished": {
            "type": "boolean",
            "description": "Nothing left in flight and something already went out. Derived, never stored — the status stays `active`, so enrolling more people revives the sequence on its own."
          },
          "busy": {
            "type": "boolean",
            "description": "An enrich or judge run is in flight for this sequence."
          },
          "unreachable": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "contact_id": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "display_name": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "phone": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "email": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "whatsapp_user_id": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "avatar_url": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "reason": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "event": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "step_index": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "contact_id",
                "display_name",
                "phone",
                "email",
                "whatsapp_user_id",
                "avatar_url",
                "reason",
                "event",
                "step_index"
              ],
              "additionalProperties": false
            },
            "description": "Who we will never reach, newest first. Capped — the count is on `wont_reach`."
          },
          "blocked": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "contact_id": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "display_name": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "phone": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "email": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "whatsapp_user_id": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "avatar_url": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "reason": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "event": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "step_index": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "contact_id",
                "display_name",
                "phone",
                "email",
                "whatsapp_user_id",
                "avatar_url",
                "reason",
                "event",
                "step_index"
              ],
              "additionalProperties": false
            },
            "description": "Who is waiting on a human, newest first. Capped — the count is on `needs_you`."
          }
        },
        "required": [
          "people",
          "will_send",
          "might_send",
          "rejected",
          "enrolled",
          "has_criteria",
          "sent",
          "replied",
          "wont_reach",
          "needs_you",
          "finished",
          "busy",
          "unreachable",
          "blocked"
        ],
        "additionalProperties": false
      },
      "LaunchSequenceOutputDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/LaunchSequenceOutputDto",
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "const": "active"
          },
          "activated": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "held_suppressed": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Candidates held back because their identity is suppressed — never armed."
          }
        },
        "required": [
          "status",
          "activated",
          "held_suppressed"
        ],
        "additionalProperties": false
      },
      "EnrichmentCatalogDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/EnrichmentCatalogDto",
        "type": "object",
        "properties": {
          "paths": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "path": {
                  "type": "string"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "string",
                    "number",
                    "boolean",
                    "date",
                    "string[]",
                    "number[]"
                  ]
                },
                "nullable": {
                  "type": "boolean"
                }
              },
              "required": [
                "path",
                "type",
                "nullable"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "paths"
        ],
        "additionalProperties": false
      },
      "SequenceRegulatoryNoticeDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SequenceRegulatoryNoticeDto",
        "type": "object",
        "properties": {
          "countries": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "ISO 3166-1 alpha-2, sorted."
          },
          "points": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The checklist the confirmation refers to — show it with the country rules."
          },
          "cards": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string",
                  "description": "ISO 3166-1 alpha-2."
                },
                "name": {
                  "type": "string"
                },
                "consent": {
                  "type": "string",
                  "enum": [
                    "opt_in",
                    "opt_out",
                    "opt_in_b2c_opt_out_b2b",
                    "unregulated",
                    "unknown"
                  ]
                },
                "consent_note": {
                  "type": "string"
                },
                "hours": {
                  "type": "object",
                  "properties": {
                    "weekdays": {
                      "type": "string"
                    },
                    "saturday": {
                      "type": "string"
                    },
                    "sunday": {
                      "type": "string"
                    },
                    "holidays": {
                      "type": "string"
                    },
                    "clock": {
                      "type": "string",
                      "enum": [
                        "called_party",
                        "national",
                        "unknown"
                      ]
                    },
                    "basis": {
                      "type": "string",
                      "enum": [
                        "statute",
                        "regulation",
                        "code_of_conduct",
                        "regulator_guidance",
                        "partial",
                        "none",
                        "unknown"
                      ],
                      "description": "Say \"required\" only for statute/regulation; the rest is guidance."
                    },
                    "note": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "weekdays",
                    "saturday",
                    "sunday",
                    "holidays",
                    "clock",
                    "basis",
                    "note"
                  ],
                  "additionalProperties": false
                },
                "frequency": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "dnc": {
                  "type": "string"
                },
                "ai_disclosure": {
                  "type": "string"
                },
                "recording": {
                  "type": "string"
                },
                "origination": {
                  "type": "string"
                },
                "origination_kind": {
                  "type": "string",
                  "enum": [
                    "foreign_origin_prohibited",
                    "local_number_required",
                    "dedicated_prefix_required",
                    "registered_series_required",
                    "own_listed_number_required",
                    "cli_must_be_presented",
                    "none_found"
                  ]
                },
                "penalties": {
                  "type": "string"
                },
                "prohibited": {
                  "type": "boolean",
                  "description": "Automated marketing calls are a prohibited class here regardless of consent."
                },
                "links": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string"
                      },
                      "url": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "name",
                      "url"
                    ],
                    "additionalProperties": false
                  }
                },
                "last_reviewed": {
                  "type": "string"
                }
              },
              "required": [
                "code",
                "name",
                "consent",
                "consent_note",
                "hours",
                "frequency",
                "dnc",
                "ai_disclosure",
                "recording",
                "origination",
                "origination_kind",
                "penalties",
                "prohibited",
                "links",
                "last_reviewed"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "countries",
          "points",
          "cards"
        ],
        "additionalProperties": false
      },
      "LaunchPreviewDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/LaunchPreviewDto",
        "type": "object",
        "properties": {
          "will_send": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "A FORECAST of how many would start sending, not a promise: consent and suppression are re-checked at claim time and fail closed."
          },
          "already_sending": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "held": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "reason": {
                  "type": "string",
                  "enum": [
                    "below_cutoff",
                    "suppressed"
                  ]
                },
                "count": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "reason",
                "count"
              ],
              "additionalProperties": false
            }
          },
          "blockers": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "reason": {
                  "type": "string",
                  "enum": [
                    "no_steps",
                    "no_sender",
                    "paused",
                    "template_not_sendable"
                  ]
                },
                "channels": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "templates": {
                  "description": "`template_not_sendable` only: which templates, and what Meta says. Only DEAD templates appear here — one still in review is in `pending_templates` and does not block.",
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string"
                      },
                      "language": {
                        "type": "string"
                      },
                      "status": {
                        "type": "string",
                        "description": "A dead state (REJECTED/DISABLED) — needs a new template."
                      }
                    },
                    "required": [
                      "name",
                      "language",
                      "status"
                    ],
                    "additionalProperties": false
                  }
                }
              },
              "required": [
                "reason"
              ],
              "additionalProperties": false
            },
            "description": "Empty means launch works. Launch itself refuses on anything here."
          },
          "pending_templates": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "language": {
                  "type": "string"
                },
                "status": {
                  "type": "string"
                }
              },
              "required": [
                "name",
                "language",
                "status"
              ],
              "additionalProperties": false
            },
            "description": "Templates still waiting on approval. These do NOT stop a launch: armed people wait and start sending the moment the template clears."
          },
          "regulatory_notice": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SequenceRegulatoryNoticeDto"
              },
              {
                "type": "null"
              }
            ],
            "description": "Informational: present when the campaign has voice steps reaching a catalogued country. Show it before launching and pass regulatory_acknowledged: true when the user confirms — the launch itself never refuses over it. Null: nothing to show."
          }
        },
        "required": [
          "will_send",
          "already_sending",
          "held",
          "blockers",
          "pending_templates",
          "regulatory_notice"
        ],
        "additionalProperties": false
      },
      "SequenceVariableCoverageDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SequenceVariableCoverageDto",
        "type": "object",
        "properties": {
          "sampled": {
            "type": "boolean",
            "description": "True when the sequence holds more people than the sample these counts read."
          },
          "sample_size": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "People the counts were read over (first N by id)."
          },
          "total": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Enrolled people on the sequence."
          },
          "sources": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "object",
              "properties": {
                "present": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991,
                  "description": "People in the sample with a non-blank value."
                },
                "missing": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991,
                  "description": "People in the sample without one."
                }
              },
              "required": [
                "present",
                "missing"
              ],
              "additionalProperties": false
            },
            "description": "Keyed by each binding's `source` — a recipient column or an attached-data key."
          }
        },
        "required": [
          "sampled",
          "sample_size",
          "total",
          "sources"
        ],
        "additionalProperties": false
      },
      "SequenceStepsWriteDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SequenceStepsWriteDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "org_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "active",
              "paused"
            ]
          },
          "paused_reason": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "trunk_missing",
                  "caller_id_missing",
                  "team_missing",
                  "telephony_off",
                  "calls_failing"
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "Set when the sequence paused itself: \"trunk_missing\" (a Human voice step's SIP trunk was deleted), \"caller_id_missing\" (its caller ID is no longer one of the workspace's verified numbers), \"team_missing\" (its team was deleted), \"telephony_off\" (telephony was turned off for the workspace) or \"calls_failing\" (most of its latest team calls failed). null when a person paused it or it is not paused. Resuming clears it."
          },
          "steps": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "channel": {
                      "type": "string",
                      "const": "whatsapp"
                    },
                    "content": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "whatsapp_template"
                        },
                        "template_name": {
                          "type": "string",
                          "minLength": 1
                        },
                        "template_language": {
                          "type": "string",
                          "minLength": 1
                        },
                        "variables": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "object",
                            "properties": {
                              "source": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200,
                                "description": "A recipient column ('display_name', 'phone', 'email') or the exact name of a key in the person's attached data (extra_data). Those three names always read the column — a key spelled the same is unreachable; any other string reads the attached data, matched verbatim as a top-level key. A missing or empty value falls to `fallback`, and with no fallback the person parks (needs_data)."
                              },
                              "fallback": {
                                "type": "string"
                              },
                              "type": {
                                "description": "Optional. Applies to attached-data sources only — ignored on the three columns. How to read the value: string, number, boolean, date, string[] or number[] — the same vocabulary as People-table columns. Absent: text and numbers pass through, anything else counts as missing. Declared: text is parsed where it is unambiguous (\"250\" as a number or a string, \"true\" as a boolean, an ISO-shaped date such as \"2026-03-12\" — other date spellings and epoch numbers are missing), a date renders as a plain day in the person's timezone, a list needs an actual list in the data and joins with commas, dropping items it cannot read, and a value that cannot be read as the declared type counts as missing.",
                                "type": "string",
                                "enum": [
                                  "string",
                                  "number",
                                  "boolean",
                                  "date",
                                  "string[]",
                                  "number[]"
                                ]
                              }
                            },
                            "required": [
                              "source"
                            ],
                            "additionalProperties": false
                          },
                          "description": "Body bindings keyed by positional index (\"1\", \"2\") or exact parameter name (\"first_name\")."
                        },
                        "buttons": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string",
                            "pattern": "^[0-9]$"
                          },
                          "additionalProperties": {
                            "type": "object",
                            "properties": {
                              "source": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200,
                                "description": "A recipient column ('display_name', 'phone', 'email') or the exact name of a key in the person's attached data (extra_data). Those three names always read the column — a key spelled the same is unreachable; any other string reads the attached data, matched verbatim as a top-level key. A missing or empty value falls to `fallback`, and with no fallback the person parks (needs_data)."
                              },
                              "fallback": {
                                "type": "string"
                              },
                              "type": {
                                "description": "Optional. Applies to attached-data sources only — ignored on the three columns. How to read the value: string, number, boolean, date, string[] or number[] — the same vocabulary as People-table columns. Absent: text and numbers pass through, anything else counts as missing. Declared: text is parsed where it is unambiguous (\"250\" as a number or a string, \"true\" as a boolean, an ISO-shaped date such as \"2026-03-12\" — other date spellings and epoch numbers are missing), a date renders as a plain day in the person's timezone, a list needs an actual list in the data and joins with commas, dropping items it cannot read, and a value that cannot be read as the declared type counts as missing.",
                                "type": "string",
                                "enum": [
                                  "string",
                                  "number",
                                  "boolean",
                                  "date",
                                  "string[]",
                                  "number[]"
                                ]
                              }
                            },
                            "required": [
                              "source"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "type",
                        "template_name",
                        "template_language",
                        "variables"
                      ],
                      "additionalProperties": false
                    },
                    "delay_minutes": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 129600
                    }
                  },
                  "required": [
                    "channel",
                    "content",
                    "delay_minutes"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "channel": {
                      "type": "string",
                      "const": "voice"
                    },
                    "content": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "voice_call"
                        },
                        "extra_instructions": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 8000
                        },
                        "variables": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 64
                          },
                          "additionalProperties": {
                            "type": "object",
                            "properties": {
                              "source": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200,
                                "description": "A recipient column ('display_name', 'phone', 'email') or the exact name of a key in the person's attached data (extra_data). Those three names always read the column — a key spelled the same is unreachable; any other string reads the attached data, matched verbatim as a top-level key. A missing or empty value falls to `fallback`, and with no fallback the person parks (needs_data)."
                              },
                              "fallback": {
                                "type": "string"
                              },
                              "type": {
                                "description": "Optional. Applies to attached-data sources only — ignored on the three columns. How to read the value: string, number, boolean, date, string[] or number[] — the same vocabulary as People-table columns. Absent: text and numbers pass through, anything else counts as missing. Declared: text is parsed where it is unambiguous (\"250\" as a number or a string, \"true\" as a boolean, an ISO-shaped date such as \"2026-03-12\" — other date spellings and epoch numbers are missing), a date renders as a plain day in the person's timezone, a list needs an actual list in the data and joins with commas, dropping items it cannot read, and a value that cannot be read as the declared type counts as missing.",
                                "type": "string",
                                "enum": [
                                  "string",
                                  "number",
                                  "boolean",
                                  "date",
                                  "string[]",
                                  "number[]"
                                ]
                              }
                            },
                            "required": [
                              "source"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "handled_by": {
                          "description": "Who takes the call: \"ai\" (default) — the sequence's AI phone agent; \"human\" — a team of agents, dialed for them through the org's own SIP trunk. Omitted = \"ai\", except on an update of a human step, which must say \"ai\" to switch it.",
                          "type": "string",
                          "enum": [
                            "ai",
                            "human"
                          ]
                        },
                        "team_id": {
                          "description": "Human steps: the team whose free agents take the calls. Required when handled_by is \"human\".",
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "trunk_id": {
                          "description": "Human steps: the org's own SIP trunk the calls go out through (see list voice trunks). Required when handled_by is \"human\".",
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                        },
                        "caller_id": {
                          "description": "Human steps: the number shown to the person, in E.164 (+ and digits), one of the workspace's verified numbers. Omitted = the trunk's default.",
                          "type": "string",
                          "pattern": "^\\+[1-9]\\d{6,14}$"
                        },
                        "numbers_per_free_agent": {
                          "description": "Human steps: how many numbers ring at once for each free agent (1–5, default 1). Above 1, a person who picks up while every agent is busy is missed and gets the next step.",
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 5
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false
                    },
                    "delay_minutes": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 129600
                    }
                  },
                  "required": [
                    "channel",
                    "content",
                    "delay_minutes"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "channel": {
                      "type": "string",
                      "const": "email"
                    },
                    "content": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "email"
                        },
                        "subject": {
                          "type": "string",
                          "minLength": 1
                        },
                        "html": {
                          "type": "string",
                          "minLength": 1
                        },
                        "text": {
                          "type": "string",
                          "minLength": 1
                        },
                        "variables": {
                          "default": {},
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "object",
                            "properties": {
                              "source": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200,
                                "description": "A recipient column ('display_name', 'phone', 'email') or the exact name of a key in the person's attached data (extra_data). Those three names always read the column — a key spelled the same is unreachable; any other string reads the attached data, matched verbatim as a top-level key. A missing or empty value falls to `fallback`, and with no fallback the person parks (needs_data)."
                              },
                              "fallback": {
                                "type": "string"
                              },
                              "type": {
                                "description": "Optional. Applies to attached-data sources only — ignored on the three columns. How to read the value: string, number, boolean, date, string[] or number[] — the same vocabulary as People-table columns. Absent: text and numbers pass through, anything else counts as missing. Declared: text is parsed where it is unambiguous (\"250\" as a number or a string, \"true\" as a boolean, an ISO-shaped date such as \"2026-03-12\" — other date spellings and epoch numbers are missing), a date renders as a plain day in the person's timezone, a list needs an actual list in the data and joins with commas, dropping items it cannot read, and a value that cannot be read as the declared type counts as missing.",
                                "type": "string",
                                "enum": [
                                  "string",
                                  "number",
                                  "boolean",
                                  "date",
                                  "string[]",
                                  "number[]"
                                ]
                              }
                            },
                            "required": [
                              "source"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "type",
                        "subject",
                        "html",
                        "text",
                        "variables"
                      ],
                      "additionalProperties": false
                    },
                    "delay_minutes": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 129600
                    }
                  },
                  "required": [
                    "channel",
                    "content",
                    "delay_minutes"
                  ],
                  "additionalProperties": false
                }
              ]
            }
          },
          "settings": {
            "type": "object",
            "properties": {
              "block_active_elsewhere": {
                "type": "boolean"
              },
              "block_contacted_before": {
                "type": "boolean"
              },
              "respect_office_hours": {
                "type": "boolean"
              },
              "office_hours_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              }
            },
            "additionalProperties": false
          },
          "brief": {
            "type": "string"
          },
          "reply_instructions": {
            "type": "string"
          },
          "criteria": {
            "type": "object",
            "properties": {
              "must": {
                "maxItems": 20,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "label": {
                      "type": "string",
                      "minLength": 2,
                      "maxLength": 60,
                      "description": "A few words naming this criterion, shown in the dashboard — \"Recent invoicing complaint\", \"Business account\". Not a sentence."
                    },
                    "text": {
                      "type": "string",
                      "minLength": 3,
                      "maxLength": 500,
                      "description": "The full instruction the judge reads. Name the boundary explicitly — what counts and what does not. Never shown in the table."
                    }
                  },
                  "required": [
                    "label",
                    "text"
                  ],
                  "additionalProperties": false
                }
              },
              "nice": {
                "maxItems": 20,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "label": {
                      "type": "string",
                      "minLength": 2,
                      "maxLength": 60,
                      "description": "A few words naming this criterion, shown in the dashboard — \"Recent invoicing complaint\", \"Business account\". Not a sentence."
                    },
                    "text": {
                      "type": "string",
                      "minLength": 3,
                      "maxLength": 500,
                      "description": "The full instruction the judge reads. Name the boundary explicitly — what counts and what does not. Never shown in the table."
                    },
                    "grade": {
                      "type": "string",
                      "enum": [
                        "high",
                        "medium",
                        "low"
                      ]
                    }
                  },
                  "required": [
                    "label",
                    "text",
                    "grade"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "must",
              "nice"
            ],
            "additionalProperties": false
          },
          "columns": {
            "maxItems": 12,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 59,
                  "pattern": "^[a-z0-9_]+$"
                },
                "label": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 60
                },
                "path": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 300
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "string",
                    "number",
                    "boolean",
                    "date",
                    "string[]",
                    "number[]"
                  ]
                }
              },
              "required": [
                "key",
                "label",
                "path",
                "type"
              ],
              "additionalProperties": false
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "deleted_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "variable_coverage": {
            "$ref": "#/components/schemas/SequenceVariableCoverageDto"
          }
        },
        "required": [
          "id",
          "org_id",
          "name",
          "status",
          "paused_reason",
          "steps",
          "settings",
          "brief",
          "reply_instructions",
          "criteria",
          "columns",
          "created_at",
          "updated_at",
          "deleted_at",
          "variable_coverage"
        ],
        "additionalProperties": false
      },
      "SequenceDataKeysDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SequenceDataKeysDto",
        "type": "object",
        "properties": {
          "sampled": {
            "type": "boolean",
            "description": "True when the sequence holds more people than the sample read."
          },
          "sample_size": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "People the keys were read over (first N by id)."
          },
          "total": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Enrolled people on the sequence."
          },
          "keys": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string",
                  "description": "A top-level attached-data key, usable verbatim as a `source`."
                },
                "present": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991,
                  "description": "People in the sample with a non-blank value at it."
                }
              },
              "required": [
                "key",
                "present"
              ],
              "additionalProperties": false
            },
            "description": "Most-covered first, at most 200 — a wider bag is truncated."
          }
        },
        "required": [
          "sampled",
          "sample_size",
          "total",
          "keys"
        ],
        "additionalProperties": false
      },
      "SequenceSendersDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SequenceSendersDto",
        "type": "object",
        "properties": {
          "senders": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "channel": {
                  "type": "string"
                },
                "sender_id": {
                  "type": "string"
                }
              },
              "required": [
                "channel",
                "sender_id"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "senders"
        ],
        "additionalProperties": false
      },
      "VoiceSendersDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/VoiceSendersDto",
        "type": "object",
        "properties": {
          "senders": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "agent_id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                  "description": "ai_phone_agents id — what set_sequence_senders binds."
                },
                "name": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "number_pool": {
                  "description": "The calling pool configured on this agent, including its sequence retry policy.",
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "pool_id": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                          "description": "The number pool this agent uses for outbound calls. Must belong to the same workspace."
                        },
                        "max_attempts": {
                          "description": "Maximum calls per sequence phone step, each using a different available number. Defaults to 3. Calls stop sooner if no unused numbers remain in the pool.",
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 3
                        },
                        "retry_delay_minutes": {
                          "description": "Minutes after an unsuccessful call finishes before the next attempt. Defaults to 2 and respects the sequence calling window.",
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 1440
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "pool_id",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "caller_number": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "The caller ID people see, when the agent presents one."
                },
                "eligible": {
                  "type": "boolean"
                },
                "ineligible_reason": {
                  "type": "string",
                  "enum": [
                    "not_livekit",
                    "foreign_trunk",
                    "no_caller_number",
                    "no_hosted_trunk",
                    "number_pool_unavailable"
                  ]
                },
                "first_message": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "persona": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              },
              "required": [
                "agent_id",
                "name",
                "caller_number",
                "eligible",
                "first_message",
                "persona"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "senders"
        ],
        "additionalProperties": false
      },
      "EmailSendersDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/EmailSendersDto",
        "type": "object",
        "properties": {
          "senders": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "mailbox_id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                  "description": "email_fleet_mailboxes id — what set_sequence_senders binds for email."
                },
                "address": {
                  "type": "string",
                  "description": "The address prospects see in the From line."
                },
                "sender_name": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "The persona name on the From line."
                },
                "eligible": {
                  "type": "boolean",
                  "description": "Whether the engine will accept this mailbox at all."
                },
                "ineligible_reason": {
                  "type": "string",
                  "enum": [
                    "not_active",
                    "domain_not_live"
                  ]
                },
                "health": {
                  "$ref": "#/components/schemas/MailboxHealthDto"
                }
              },
              "required": [
                "mailbox_id",
                "address",
                "sender_name",
                "eligible",
                "health"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "senders"
        ],
        "additionalProperties": false
      },
      "AddSequenceContactsOutputDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/AddSequenceContactsOutputDto",
        "type": "object",
        "properties": {
          "results": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "outcome": {
                  "type": "string",
                  "enum": [
                    "enrolled",
                    "updated",
                    "already_enrolled",
                    "skipped_previously_exited",
                    "skipped_suppressed",
                    "skipped_active_elsewhere",
                    "skipped_contacted_before",
                    "no_identity",
                    "skipped_cannot_create_contact",
                    "extra_data_too_large",
                    "session_custom_data_too_large",
                    "conflict",
                    "error"
                  ],
                  "description": "enrolled: new row created · updated: existing candidate refreshed — or a parked person given new data, who resumes their step: armed immediately on a live sequence, back to candidate on a draft or when their judged fit is below the cutoff; a parked person given ONLY session_custom_data keeps it merged and stays parked · already_enrolled: already active/completed here (or parked with nothing new supplied), no-op · skipped_previously_exited: exited here — an exit is terminal, enrolling never restarts a concluded journey · skipped_suppressed: on the do-not-contact list · skipped_active_elsewhere: active in another campaign (block-toggle) · skipped_contacted_before: some campaign already messaged them (block-toggle) · no_identity: no valid phone, email, or whatsapp_user_id after normalization · skipped_cannot_create_contact: matched no existing contact and the caller lacks contacts:write, so no contact was created — nothing written ·extra_data_too_large: the extra_data bag exceeds its budget (detail carries size and budget), nothing written — trim and retry just this person · session_custom_data_too_large: the session bag — or its per-key merge with what the person already holds (detail.merged=true) — exceeds 50 keys / 8,000 characters (detail carries keys, size and the caps), nothing written — trim and retry just this person · conflict: handles match two different existing people (detail.matches carries their contact ids), nothing written · error: this row failed unexpectedly, retry just this person"
                },
                "contact_id": {
                  "description": "The person's CRM contact — the identifier every person-scoped op takes. Present whenever a row exists (enrolled, updated, already_enrolled, skipped_previously_exited, and suppressed people who already held a row); absent for outcomes that never touched a row.",
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "detail": {
                  "description": "Machine-readable context: dropped=[fields rejected by normalization] · in_batch=true (duplicate within this call) · matches=[contact ids] on conflict · per-channel suppressed addresses · size/budget (and merged=true when the stored bag would overflow) on extra_data_too_large · keys/max_keys/size/max_size (and merged=true) on session_custom_data_too_large",
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {}
                }
              },
              "required": [
                "outcome"
              ],
              "additionalProperties": false
            }
          },
          "summary": {
            "type": "object",
            "properties": {
              "enrolled": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "not_enrolled": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "noop": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "enrolled",
              "not_enrolled",
              "noop"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "results",
          "summary"
        ],
        "additionalProperties": false
      },
      "SequenceVoiceTrunksDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SequenceVoiceTrunksDto",
        "type": "object",
        "properties": {
          "trunks": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                  "description": "Pass as `trunk_id` on a Human voice step."
                },
                "name": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "name"
              ],
              "additionalProperties": false
            },
            "description": "The org's own SIP trunks — the only trunks a Human voice step can call through."
          }
        },
        "required": [
          "trunks"
        ],
        "additionalProperties": false
      },
      "SequenceCallAttemptsDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SequenceCallAttemptsDto",
        "type": "object",
        "properties": {
          "attempts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "contact_id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                  "description": "The person in the sequence (their contact id)."
                },
                "step_index": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "team_id": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "dialing",
                    "done"
                  ],
                  "description": "\"dialing\" while the call is live, then \"done\"."
                },
                "result": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "answered",
                        "no_answer",
                        "busy",
                        "failed",
                        "missed",
                        "voicemail",
                        "wrong_number"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "How the call ended: answered (an agent took it), no_answer, busy, failed, missed (picked up, but no agent was free), voicemail, wrong_number. null while live."
                },
                "answered_by": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "The agent (user id) who took the call."
                },
                "corrected": {
                  "type": "boolean",
                  "description": "The agent who took the call changed its result."
                },
                "session_id": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "The call's inbox session."
                },
                "dialed_at": {
                  "type": "string",
                  "format": "date-time"
                },
                "completed_at": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "id",
                "contact_id",
                "step_index",
                "team_id",
                "status",
                "result",
                "answered_by",
                "corrected",
                "session_id",
                "dialed_at",
                "completed_at"
              ],
              "additionalProperties": false
            }
          },
          "next_before": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Opaque cursor: pass as `before` for the next (older) page; null on the last page."
          }
        },
        "required": [
          "attempts",
          "next_before"
        ],
        "additionalProperties": false
      },
      "EmailFleetSuggestionDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/EmailFleetSuggestionDto",
        "type": "object",
        "properties": {
          "domain": {
            "type": "string"
          },
          "available": {
            "type": "boolean"
          },
          "price_cents": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "is_bare_brand": {
            "type": "boolean"
          }
        },
        "required": [
          "domain",
          "available",
          "price_cents",
          "is_bare_brand"
        ],
        "additionalProperties": false
      },
      "SuggestEmailFleetDomainsResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SuggestEmailFleetDomainsResponseDto",
        "type": "object",
        "properties": {
          "suggestions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EmailFleetSuggestionDto"
            }
          }
        },
        "required": [
          "suggestions"
        ],
        "additionalProperties": false
      },
      "EmailFleetStatusDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/EmailFleetStatusDto",
        "type": "object",
        "properties": {
          "domains": {
            "type": "object",
            "properties": {
              "total": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "by_status": {
                "type": "object",
                "propertyNames": {
                  "type": "string",
                  "enum": [
                    "purchasing",
                    "registered",
                    "ns_delegated",
                    "pending_dns",
                    "connecting",
                    "provisioning",
                    "active",
                    "purchase_failed",
                    "suspended",
                    "retiring",
                    "expired"
                  ]
                },
                "additionalProperties": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              }
            },
            "required": [
              "total",
              "by_status"
            ],
            "additionalProperties": false
          },
          "held": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "max_domains": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "mailboxes": {
            "type": "object",
            "properties": {
              "total": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "by_status": {
                "type": "object",
                "propertyNames": {
                  "type": "string",
                  "enum": [
                    "pending",
                    "created",
                    "active",
                    "failed",
                    "suspended",
                    "deleting",
                    "deleted"
                  ]
                },
                "additionalProperties": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              }
            },
            "required": [
              "total",
              "by_status"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "domains",
          "held",
          "max_domains",
          "mailboxes"
        ],
        "additionalProperties": false
      },
      "EmailFleetDnsSetupDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/EmailFleetDnsSetupDto",
        "type": "object",
        "properties": {
          "domain_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "domain": {
            "type": "string"
          },
          "zone": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "preparing",
              "needs_dns",
              "verified",
              "check_failed"
            ]
          },
          "checked_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "records": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "A",
                    "MX",
                    "TXT",
                    "CNAME"
                  ]
                },
                "host": {
                  "type": "string",
                  "minLength": 1
                },
                "value": {
                  "type": "string",
                  "minLength": 1
                },
                "ttl": {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "maximum": 9007199254740991
                },
                "purpose": {
                  "type": "string"
                },
                "actual": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "verified": {
                  "anyOf": [
                    {
                      "type": "boolean"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "type",
                "host",
                "value",
                "ttl",
                "actual",
                "verified"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "domain_id",
          "domain",
          "zone",
          "status",
          "checked_at",
          "records"
        ],
        "additionalProperties": false
      },
      "EmailFleetDnsSetupsDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/EmailFleetDnsSetupsDto",
        "type": "object",
        "properties": {
          "domains": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EmailFleetDnsSetupDto"
            }
          }
        },
        "required": [
          "domains"
        ],
        "additionalProperties": false
      },
      "SkillDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SkillDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "org_id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "org_id",
          "name",
          "description",
          "created_at",
          "updated_at"
        ],
        "additionalProperties": false
      },
      "CustomTrainingDirectoriesDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CustomTrainingDirectoriesDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "org_id": {
            "type": "string"
          },
          "parent_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Parent folder id; null for a top-level folder."
          }
        },
        "required": [
          "id",
          "name",
          "org_id",
          "parent_id"
        ],
        "additionalProperties": false
      },
      "SalesforceCrmConnectionStatusDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SalesforceCrmConnectionStatusDto",
        "type": "object",
        "properties": {
          "is_active": {
            "type": "boolean"
          }
        },
        "required": [
          "is_active"
        ],
        "additionalProperties": false
      },
      "SalesforceCrmContactResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SalesforceCrmContactResponseDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "organization_id": {
            "type": "string"
          },
          "salesforce_record_id": {
            "type": "string"
          },
          "record_type": {
            "type": "string",
            "enum": [
              "Contact",
              "Lead"
            ]
          },
          "email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "phone": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "first_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "last_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "company": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "salesforce_data": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "cached_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "organization_id",
          "salesforce_record_id",
          "record_type",
          "email",
          "phone",
          "first_name",
          "last_name",
          "company",
          "salesforce_data",
          "cached_at"
        ],
        "additionalProperties": false
      },
      "PaginatedSalesforceCrmContactsResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/PaginatedSalesforceCrmContactsResponseDto",
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SalesforceCrmContactResponseDto"
            }
          },
          "meta": {
            "type": "object",
            "properties": {
              "total": {
                "type": "number"
              },
              "page": {
                "type": "number"
              },
              "limit": {
                "type": "number"
              },
              "totalPages": {
                "type": "number"
              }
            },
            "required": [
              "total",
              "page",
              "limit",
              "totalPages"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "data",
          "meta"
        ],
        "additionalProperties": false
      },
      "RestoreDeletedResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/RestoreDeletedResponseDto",
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          }
        },
        "required": [
          "ok"
        ],
        "additionalProperties": false
      },
      "CategoryWithLocalesResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CategoryWithLocalesResponseDto",
        "type": "object",
        "properties": {
          "entity": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "help_center_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "icon": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "parent_id": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "created_at": {
                "type": "string",
                "format": "date-time"
              }
            },
            "required": [
              "id",
              "help_center_id",
              "icon",
              "parent_id",
              "created_at"
            ],
            "additionalProperties": false
          },
          "locales": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "category_entity_id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "help_center_id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "language_code": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "slug": {
                  "type": "string"
                },
                "description": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "is_manual": {
                  "anyOf": [
                    {
                      "type": "boolean"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "created_at": {
                  "type": "string",
                  "format": "date-time"
                }
              },
              "required": [
                "id",
                "category_entity_id",
                "help_center_id",
                "language_code",
                "name",
                "slug",
                "description",
                "is_manual",
                "created_at"
              ],
              "additionalProperties": false
            }
          },
          "primaryLocale": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "category_entity_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "help_center_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "language_code": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "slug": {
                "type": "string"
              },
              "description": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "is_manual": {
                "anyOf": [
                  {
                    "type": "boolean"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "created_at": {
                "type": "string",
                "format": "date-time"
              }
            },
            "required": [
              "id",
              "category_entity_id",
              "help_center_id",
              "language_code",
              "name",
              "slug",
              "description",
              "is_manual",
              "created_at"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "entity",
          "locales"
        ],
        "additionalProperties": false
      },
      "CategoryListItemResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CategoryListItemResponseDto",
        "type": "object",
        "properties": {
          "entity": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "help_center_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "icon": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "parent_id": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "created_at": {
                "type": "string",
                "format": "date-time"
              }
            },
            "required": [
              "id",
              "help_center_id",
              "icon",
              "parent_id",
              "created_at"
            ],
            "additionalProperties": false
          },
          "locale": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "category_entity_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "help_center_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "language_code": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "slug": {
                "type": "string"
              },
              "description": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "is_manual": {
                "anyOf": [
                  {
                    "type": "boolean"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "created_at": {
                "type": "string",
                "format": "date-time"
              }
            },
            "required": [
              "id",
              "category_entity_id",
              "help_center_id",
              "language_code",
              "name",
              "slug",
              "description",
              "is_manual",
              "created_at"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "entity"
        ],
        "additionalProperties": false
      },
      "CreateCategoryResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CreateCategoryResponseDto",
        "type": "object",
        "properties": {
          "entity": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "help_center_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "icon": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "parent_id": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "created_at": {
                "type": "string",
                "format": "date-time"
              }
            },
            "required": [
              "id",
              "help_center_id",
              "icon",
              "parent_id",
              "created_at"
            ],
            "additionalProperties": false
          },
          "primaryLocale": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "category_entity_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "help_center_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "language_code": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "slug": {
                "type": "string"
              },
              "description": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "is_manual": {
                "anyOf": [
                  {
                    "type": "boolean"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "created_at": {
                "type": "string",
                "format": "date-time"
              }
            },
            "required": [
              "id",
              "category_entity_id",
              "help_center_id",
              "language_code",
              "name",
              "slug",
              "description",
              "is_manual",
              "created_at"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "entity",
          "primaryLocale"
        ],
        "additionalProperties": false
      },
      "UpdateCategoryInLanguageResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdateCategoryInLanguageResponseDto",
        "type": "object",
        "properties": {
          "primaryLocale": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "category_entity_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "help_center_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "language_code": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "slug": {
                "type": "string"
              },
              "description": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "is_manual": {
                "anyOf": [
                  {
                    "type": "boolean"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "created_at": {
                "type": "string",
                "format": "date-time"
              }
            },
            "required": [
              "id",
              "category_entity_id",
              "help_center_id",
              "language_code",
              "name",
              "slug",
              "description",
              "is_manual",
              "created_at"
            ],
            "additionalProperties": false
          },
          "locale": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "category_entity_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "help_center_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "language_code": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "slug": {
                "type": "string"
              },
              "description": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "is_manual": {
                "anyOf": [
                  {
                    "type": "boolean"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "created_at": {
                "type": "string",
                "format": "date-time"
              }
            },
            "required": [
              "id",
              "category_entity_id",
              "help_center_id",
              "language_code",
              "name",
              "slug",
              "description",
              "is_manual",
              "created_at"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "primaryLocale",
          "locale"
        ],
        "additionalProperties": false
      },
      "ArticleWithVersionsResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ArticleWithVersionsResponseDto",
        "type": "object",
        "properties": {
          "entity": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "help_center_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "category_entity_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "source_language_code": {
                "type": "string"
              },
              "created_at": {
                "type": "string",
                "format": "date-time"
              }
            },
            "required": [
              "id",
              "help_center_id",
              "category_entity_id",
              "source_language_code",
              "created_at"
            ],
            "additionalProperties": false
          },
          "activeSourceVersion": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  "entity_id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  "version_number": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "content_html": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "meta_title": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "meta_description": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "generated_from_session_id": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "created_at": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "is_active": {
                    "anyOf": [
                      {
                        "type": "boolean"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "id",
                  "entity_id",
                  "version_number",
                  "content_html",
                  "meta_title",
                  "meta_description",
                  "generated_from_session_id",
                  "created_at",
                  "is_active"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "latestSourceVersion": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  "entity_id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  "version_number": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "content_html": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "meta_title": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "meta_description": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "generated_from_session_id": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "created_at": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "is_active": {
                    "anyOf": [
                      {
                        "type": "boolean"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "id",
                  "entity_id",
                  "version_number",
                  "content_html",
                  "meta_title",
                  "meta_description",
                  "generated_from_session_id",
                  "created_at",
                  "is_active"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "locale": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  "source_version_id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  "entity_id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  "help_center_id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  "language_code": {
                    "type": "string"
                  },
                  "title": {
                    "type": "string"
                  },
                  "slug": {
                    "type": "string"
                  },
                  "content_html": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "is_manual": {
                    "anyOf": [
                      {
                        "type": "boolean"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "translated_from_locale_version_id": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "created_at": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "is_published": {
                    "anyOf": [
                      {
                        "type": "boolean"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "published_at": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "id",
                  "source_version_id",
                  "entity_id",
                  "help_center_id",
                  "language_code",
                  "title",
                  "slug",
                  "content_html",
                  "is_manual",
                  "translated_from_locale_version_id",
                  "created_at",
                  "is_published",
                  "published_at"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "entity",
          "activeSourceVersion",
          "latestSourceVersion",
          "locale"
        ],
        "additionalProperties": false
      },
      "ArticleListItemResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ArticleListItemResponseDto",
        "type": "object",
        "properties": {
          "entity": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "help_center_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "category_entity_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "source_language_code": {
                "type": "string"
              },
              "created_at": {
                "type": "string",
                "format": "date-time"
              }
            },
            "required": [
              "id",
              "help_center_id",
              "category_entity_id",
              "source_language_code",
              "created_at"
            ],
            "additionalProperties": false
          },
          "activeSourceVersion": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "entity_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "version_number": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "content_html": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "meta_title": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "meta_description": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "generated_from_session_id": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "created_at": {
                "type": "string",
                "format": "date-time"
              },
              "is_active": {
                "anyOf": [
                  {
                    "type": "boolean"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "id",
              "entity_id",
              "version_number",
              "content_html",
              "meta_title",
              "meta_description",
              "generated_from_session_id",
              "created_at",
              "is_active"
            ],
            "additionalProperties": false
          },
          "locale": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  "source_version_id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  "entity_id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  "help_center_id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  "language_code": {
                    "type": "string"
                  },
                  "title": {
                    "type": "string"
                  },
                  "slug": {
                    "type": "string"
                  },
                  "content_html": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "is_manual": {
                    "anyOf": [
                      {
                        "type": "boolean"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "translated_from_locale_version_id": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "created_at": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "is_published": {
                    "anyOf": [
                      {
                        "type": "boolean"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "published_at": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "id",
                  "source_version_id",
                  "entity_id",
                  "help_center_id",
                  "language_code",
                  "title",
                  "slug",
                  "content_html",
                  "is_manual",
                  "translated_from_locale_version_id",
                  "created_at",
                  "is_published",
                  "published_at"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "entity",
          "activeSourceVersion",
          "locale"
        ],
        "additionalProperties": false
      },
      "CreateArticleResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CreateArticleResponseDto",
        "type": "object",
        "properties": {
          "entity": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "help_center_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "category_entity_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "source_language_code": {
                "type": "string"
              },
              "created_at": {
                "type": "string",
                "format": "date-time"
              }
            },
            "required": [
              "id",
              "help_center_id",
              "category_entity_id",
              "source_language_code",
              "created_at"
            ],
            "additionalProperties": false
          },
          "sourceVersion": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "entity_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "version_number": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "content_html": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "meta_title": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "meta_description": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "generated_from_session_id": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "created_at": {
                "type": "string",
                "format": "date-time"
              },
              "is_active": {
                "anyOf": [
                  {
                    "type": "boolean"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "id",
              "entity_id",
              "version_number",
              "content_html",
              "meta_title",
              "meta_description",
              "generated_from_session_id",
              "created_at",
              "is_active"
            ],
            "additionalProperties": false
          },
          "primaryLocale": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "source_version_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "entity_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "help_center_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "language_code": {
                "type": "string"
              },
              "title": {
                "type": "string"
              },
              "slug": {
                "type": "string"
              },
              "content_html": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "is_manual": {
                "anyOf": [
                  {
                    "type": "boolean"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "translated_from_locale_version_id": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "created_at": {
                "type": "string",
                "format": "date-time"
              },
              "is_published": {
                "anyOf": [
                  {
                    "type": "boolean"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "published_at": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "id",
              "source_version_id",
              "entity_id",
              "help_center_id",
              "language_code",
              "title",
              "slug",
              "content_html",
              "is_manual",
              "translated_from_locale_version_id",
              "created_at",
              "is_published",
              "published_at"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "entity",
          "sourceVersion",
          "primaryLocale"
        ],
        "additionalProperties": false
      },
      "EditArticleResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/EditArticleResponseDto",
        "type": "object",
        "properties": {
          "sourceVersion": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  "entity_id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  "version_number": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "content_html": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "meta_title": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "meta_description": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "generated_from_session_id": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "created_at": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "is_active": {
                    "anyOf": [
                      {
                        "type": "boolean"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "id",
                  "entity_id",
                  "version_number",
                  "content_html",
                  "meta_title",
                  "meta_description",
                  "generated_from_session_id",
                  "created_at",
                  "is_active"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "locale": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "source_version_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "entity_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "help_center_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "language_code": {
                "type": "string"
              },
              "title": {
                "type": "string"
              },
              "slug": {
                "type": "string"
              },
              "content_html": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "is_manual": {
                "anyOf": [
                  {
                    "type": "boolean"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "translated_from_locale_version_id": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "created_at": {
                "type": "string",
                "format": "date-time"
              },
              "is_published": {
                "anyOf": [
                  {
                    "type": "boolean"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "published_at": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "id",
              "source_version_id",
              "entity_id",
              "help_center_id",
              "language_code",
              "title",
              "slug",
              "content_html",
              "is_manual",
              "translated_from_locale_version_id",
              "created_at",
              "is_published",
              "published_at"
            ],
            "additionalProperties": false
          },
          "primaryLocale": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "source_version_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "entity_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "help_center_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "language_code": {
                "type": "string"
              },
              "title": {
                "type": "string"
              },
              "slug": {
                "type": "string"
              },
              "content_html": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "is_manual": {
                "anyOf": [
                  {
                    "type": "boolean"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "translated_from_locale_version_id": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "created_at": {
                "type": "string",
                "format": "date-time"
              },
              "is_published": {
                "anyOf": [
                  {
                    "type": "boolean"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "published_at": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "id",
              "source_version_id",
              "entity_id",
              "help_center_id",
              "language_code",
              "title",
              "slug",
              "content_html",
              "is_manual",
              "translated_from_locale_version_id",
              "created_at",
              "is_published",
              "published_at"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "sourceVersion",
          "locale"
        ],
        "additionalProperties": false
      },
      "ArticleVersionActorDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ArticleVersionActorDto",
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "api",
              "system",
              "user"
            ]
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "user_id": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "avatar_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "type",
          "name",
          "user_id",
          "avatar_url"
        ],
        "additionalProperties": false
      },
      "ArticleVersionsResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ArticleVersionsResponseDto",
        "type": "object",
        "properties": {
          "versions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "source_version_id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "version_number": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "created_at": {
                  "type": "string",
                  "format": "date-time"
                },
                "is_active": {
                  "anyOf": [
                    {
                      "type": "boolean"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "created_by": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/ArticleVersionActorDto"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "locales": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                      },
                      "title": {
                        "type": "string"
                      },
                      "slug": {
                        "type": "string"
                      },
                      "is_manual": {
                        "anyOf": [
                          {
                            "type": "boolean"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "content_html": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "created_at": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "is_published": {
                        "anyOf": [
                          {
                            "type": "boolean"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "published_at": {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "date-time"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "created_by": {
                        "anyOf": [
                          {
                            "$ref": "#/components/schemas/ArticleVersionActorDto"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "published_by": {
                        "anyOf": [
                          {
                            "$ref": "#/components/schemas/ArticleVersionActorDto"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "id",
                      "title",
                      "slug",
                      "is_manual",
                      "content_html",
                      "created_at",
                      "is_published",
                      "published_at",
                      "created_by",
                      "published_by"
                    ],
                    "additionalProperties": false
                  }
                }
              },
              "required": [
                "source_version_id",
                "version_number",
                "created_at",
                "is_active",
                "created_by",
                "locales"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "versions"
        ],
        "additionalProperties": false
      },
      "ArticleBacklinkDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ArticleBacklinkDto",
        "type": "object",
        "properties": {
          "entity_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "title": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "published_languages": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "draft_languages": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "entity_id",
          "title",
          "slug",
          "published_languages",
          "draft_languages"
        ],
        "additionalProperties": false
      },
      "ArticleBacklinksResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ArticleBacklinksResponseDto",
        "type": "object",
        "properties": {
          "backlinks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ArticleBacklinkDto"
            }
          }
        },
        "required": [
          "backlinks"
        ],
        "additionalProperties": false
      },
      "TranslationJobResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/TranslationJobResponseDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "source_version_id": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              {
                "type": "null"
              }
            ]
          },
          "entity_id": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              {
                "type": "null"
              }
            ]
          },
          "category_entity_id": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              {
                "type": "null"
              }
            ]
          },
          "help_center_id": {
            "type": "string"
          },
          "language_code": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          },
          "progress": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 100
              },
              {
                "type": "null"
              }
            ]
          },
          "error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "started_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "finished_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "source_version_id",
          "entity_id",
          "category_entity_id",
          "help_center_id",
          "language_code",
          "status",
          "reason",
          "progress",
          "error",
          "created_at",
          "started_at",
          "finished_at"
        ],
        "additionalProperties": false
      },
      "ArticleLanguageStatesDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ArticleLanguageStatesDto",
        "type": "object",
        "properties": {
          "languages": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "language_code": {
                  "type": "string"
                },
                "has_version": {
                  "type": "boolean"
                },
                "is_published": {
                  "type": "boolean"
                },
                "has_draft": {
                  "type": "boolean"
                }
              },
              "required": [
                "language_code",
                "has_version",
                "is_published",
                "has_draft"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "languages"
        ],
        "additionalProperties": false
      },
      "GlossaryTermDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/GlossaryTermDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "help_center_id": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              {
                "type": "null"
              }
            ]
          },
          "term": {
            "type": "string"
          },
          "definition": {
            "type": "string"
          },
          "created_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "updated_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "help_center_id",
          "term",
          "definition",
          "created_at",
          "updated_at"
        ],
        "additionalProperties": false
      },
      "HelpCenterTreeResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/HelpCenterTreeResponseDto",
        "type": "object",
        "properties": {
          "topics": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "entity_id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "name": {
                  "type": "string"
                },
                "description": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "slug": {
                  "type": "string"
                },
                "icon": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "position": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "articles": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "entity_id": {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                      },
                      "title": {
                        "type": "string"
                      },
                      "position": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "has_version": {
                        "type": "boolean"
                      },
                      "has_published_version": {
                        "type": "boolean"
                      },
                      "has_draft": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "entity_id",
                      "title",
                      "position",
                      "has_version",
                      "has_published_version",
                      "has_draft"
                    ],
                    "additionalProperties": false
                  }
                },
                "topics": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "entity_id": {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                      },
                      "name": {
                        "type": "string"
                      },
                      "description": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "slug": {
                        "type": "string"
                      },
                      "icon": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "position": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "articles": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "entity_id": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                            },
                            "title": {
                              "type": "string"
                            },
                            "position": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "has_version": {
                              "type": "boolean"
                            },
                            "has_published_version": {
                              "type": "boolean"
                            },
                            "has_draft": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "entity_id",
                            "title",
                            "position",
                            "has_version",
                            "has_published_version",
                            "has_draft"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "topics": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "entity_id": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                            },
                            "name": {
                              "type": "string"
                            },
                            "description": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "slug": {
                              "type": "string"
                            },
                            "icon": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "position": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "articles": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "entity_id": {
                                    "type": "string",
                                    "format": "uuid",
                                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                                  },
                                  "title": {
                                    "type": "string"
                                  },
                                  "position": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "has_version": {
                                    "type": "boolean"
                                  },
                                  "has_published_version": {
                                    "type": "boolean"
                                  },
                                  "has_draft": {
                                    "type": "boolean"
                                  }
                                },
                                "required": [
                                  "entity_id",
                                  "title",
                                  "position",
                                  "has_version",
                                  "has_published_version",
                                  "has_draft"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "topics": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "entity_id": {
                                    "type": "string",
                                    "format": "uuid",
                                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                                  },
                                  "name": {
                                    "type": "string"
                                  },
                                  "description": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "slug": {
                                    "type": "string"
                                  },
                                  "icon": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "position": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "articles": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "entity_id": {
                                          "type": "string",
                                          "format": "uuid",
                                          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                                        },
                                        "title": {
                                          "type": "string"
                                        },
                                        "position": {
                                          "type": "integer",
                                          "minimum": -9007199254740991,
                                          "maximum": 9007199254740991
                                        },
                                        "has_version": {
                                          "type": "boolean"
                                        },
                                        "has_published_version": {
                                          "type": "boolean"
                                        },
                                        "has_draft": {
                                          "type": "boolean"
                                        }
                                      },
                                      "required": [
                                        "entity_id",
                                        "title",
                                        "position",
                                        "has_version",
                                        "has_published_version",
                                        "has_draft"
                                      ],
                                      "additionalProperties": false
                                    }
                                  },
                                  "topics": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "entity_id": {
                                          "type": "string",
                                          "format": "uuid",
                                          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                                        },
                                        "name": {
                                          "type": "string"
                                        },
                                        "description": {
                                          "anyOf": [
                                            {
                                              "type": "string"
                                            },
                                            {
                                              "type": "null"
                                            }
                                          ]
                                        },
                                        "slug": {
                                          "type": "string"
                                        },
                                        "icon": {
                                          "anyOf": [
                                            {
                                              "type": "string"
                                            },
                                            {
                                              "type": "null"
                                            }
                                          ]
                                        },
                                        "position": {
                                          "type": "integer",
                                          "minimum": -9007199254740991,
                                          "maximum": 9007199254740991
                                        },
                                        "articles": {
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {
                                              "entity_id": {
                                                "type": "string",
                                                "format": "uuid",
                                                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                                              },
                                              "title": {
                                                "type": "string"
                                              },
                                              "position": {
                                                "type": "integer",
                                                "minimum": -9007199254740991,
                                                "maximum": 9007199254740991
                                              },
                                              "has_version": {
                                                "type": "boolean"
                                              },
                                              "has_published_version": {
                                                "type": "boolean"
                                              },
                                              "has_draft": {
                                                "type": "boolean"
                                              }
                                            },
                                            "required": [
                                              "entity_id",
                                              "title",
                                              "position",
                                              "has_version",
                                              "has_published_version",
                                              "has_draft"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "topics": {
                                          "default": [],
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {},
                                            "additionalProperties": false
                                          }
                                        }
                                      },
                                      "required": [
                                        "entity_id",
                                        "name",
                                        "description",
                                        "slug",
                                        "icon",
                                        "position",
                                        "articles",
                                        "topics"
                                      ],
                                      "additionalProperties": false
                                    }
                                  }
                                },
                                "required": [
                                  "entity_id",
                                  "name",
                                  "description",
                                  "slug",
                                  "icon",
                                  "position",
                                  "articles",
                                  "topics"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "entity_id",
                            "name",
                            "description",
                            "slug",
                            "icon",
                            "position",
                            "articles",
                            "topics"
                          ],
                          "additionalProperties": false
                        }
                      }
                    },
                    "required": [
                      "entity_id",
                      "name",
                      "description",
                      "slug",
                      "icon",
                      "position",
                      "articles",
                      "topics"
                    ],
                    "additionalProperties": false
                  }
                }
              },
              "required": [
                "entity_id",
                "name",
                "description",
                "slug",
                "icon",
                "position",
                "articles",
                "topics"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "topics"
        ],
        "additionalProperties": false
      },
      "HelpCenterStructureOkDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/HelpCenterStructureOkDto",
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          }
        },
        "required": [
          "ok"
        ],
        "additionalProperties": false
      },
      "HcMediaFileDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/HcMediaFileDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "file_name": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "content_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "file_size": {
            "type": "number"
          },
          "checksum": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "file_name",
          "url",
          "content_type",
          "file_size",
          "checksum",
          "created_at"
        ],
        "additionalProperties": false
      },
      "HcMediaUploadResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/HcMediaUploadResponseDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "file_name": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "url",
          "file_name"
        ],
        "additionalProperties": false
      },
      "SelectWorkflowRunStepDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SelectWorkflowRunStepDto",
        "type": "object",
        "properties": {
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "id": {
            "type": "number"
          },
          "step_id": {
            "type": "string"
          },
          "workflow_run_id": {
            "type": "string"
          },
          "result": {},
          "step_input": {
            "anyOf": [
              {},
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "canceled",
              "completed",
              "failed",
              "idle",
              "in_progress",
              "skipped",
              "waiting"
            ]
          },
          "started_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "ended_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "workflow_id": {
            "type": "string"
          },
          "duration_in_milliseconds": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "wrapper_block_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "wrapper_block_run_id": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "resume_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "resume_job_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "created_at",
          "id",
          "step_id",
          "workflow_run_id",
          "result",
          "step_input",
          "status",
          "started_at",
          "ended_at",
          "workflow_id",
          "duration_in_milliseconds",
          "wrapper_block_id",
          "wrapper_block_run_id",
          "resume_at",
          "resume_job_id"
        ],
        "additionalProperties": false
      },
      "WorkflowRunLogEntryDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/WorkflowRunLogEntryDto",
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "failure",
              "info",
              "success",
              "warning"
            ]
          },
          "log": {},
          "block_branch": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "block_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "id": {
            "type": "string"
          },
          "step_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "step_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "timestamp": {
            "type": "string",
            "format": "date-time"
          },
          "workflow_run_id": {
            "type": "string"
          }
        },
        "required": [
          "type",
          "log",
          "block_branch",
          "block_id",
          "id",
          "step_id",
          "step_type",
          "timestamp",
          "workflow_run_id"
        ],
        "additionalProperties": false
      },
      "VerifiedWidgetContactTokenResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/VerifiedWidgetContactTokenResponseDto",
        "type": "object",
        "properties": {
          "token": {
            "type": "string",
            "description": "The JWT token to use for further requests"
          },
          "contact": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "primary_external_id": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "id",
              "primary_external_id"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "token",
          "contact"
        ],
        "additionalProperties": false
      },
      "ActionPublicResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ActionPublicResponseDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique action ID"
          },
          "name": {
            "type": "string",
            "description": "Action display name"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "What this action does"
          },
          "api_endpoint": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The API endpoint URL this action calls"
          },
          "request_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "HTTP method (GET, POST, PUT, PATCH, DELETE)"
          },
          "operation_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Unique operation ID used to reference this action"
          },
          "payload": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "base_url": {
                    "description": "Base URL for the API endpoint",
                    "type": "string"
                  },
                  "path": {
                    "description": "API path (e.g. \"/api/v1/bookings\")",
                    "type": "string"
                  },
                  "method": {
                    "description": "HTTP method (get, post, put, delete, patch)",
                    "type": "string"
                  },
                  "operationId": {
                    "description": "OpenAPI operation ID",
                    "type": "string"
                  },
                  "summary": {
                    "type": "string"
                  },
                  "description": {
                    "type": "string"
                  },
                  "parameters": {
                    "description": "Request parameters",
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "description": "Parameter name"
                        },
                        "in": {
                          "type": "string",
                          "enum": [
                            "query",
                            "path",
                            "header",
                            "cookie"
                          ],
                          "description": "Where the parameter is sent"
                        },
                        "description": {
                          "type": "string"
                        },
                        "required": {
                          "type": "boolean"
                        },
                        "value": {
                          "description": "Fixed value for a query or path parameter. Omit or set null for a dynamic parameter.",
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "schema": {
                          "description": "JSON Schema for the parameter value",
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {}
                        }
                      },
                      "required": [
                        "name",
                        "in"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "requestBody": {
                    "description": "Request body specification",
                    "type": "object",
                    "properties": {
                      "description": {
                        "type": "string"
                      },
                      "required": {
                        "type": "boolean"
                      },
                      "content": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {
                          "type": "object",
                          "properties": {
                            "schema": {
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {}
                            }
                          },
                          "additionalProperties": false
                        },
                        "description": "Content type to schema mapping (e.g. \"application/json\": { schema: {...} })"
                      }
                    },
                    "required": [
                      "content"
                    ],
                    "additionalProperties": false
                  },
                  "responses": {
                    "description": "Response specifications keyed by status code",
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  }
                },
                "additionalProperties": {},
                "description": "OpenAPI-style operation specification for the action"
              },
              {
                "type": "null"
              }
            ],
            "description": "OpenAPI-style operation spec defining parameters, request body, and responses"
          },
          "status": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Action status (e.g. \"live\")"
          },
          "pinned": {
            "type": "boolean",
            "description": "Whether this action is pinned prominently"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Tags for organizing actions"
          },
          "enabled_on_channel": {
            "type": "object",
            "properties": {
              "channels": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SessionChannel"
                },
                "description": "Channels where this action is available"
              }
            },
            "required": [
              "channels"
            ],
            "additionalProperties": false,
            "description": "Channel restrictions"
          },
          "is_handoff_like": {
            "type": "boolean",
            "description": "Whether this action behaves like a handoff to a human agent"
          },
          "require_form_submission": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "description": "Whether a form must be submitted before the action executes"
          },
          "restricted_to_segments": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Contact segment ids this action is restricted to. Empty = available to all contacts."
          },
          "created_at": {
            "description": "When the action was created",
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "description": "When the action was last updated",
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "name",
          "description",
          "api_endpoint",
          "request_type",
          "operation_id",
          "payload",
          "status",
          "pinned",
          "tags",
          "enabled_on_channel",
          "is_handoff_like",
          "require_form_submission",
          "restricted_to_segments",
          "created_at",
          "updated_at"
        ],
        "additionalProperties": false
      },
      "InvokeActionResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/InvokeActionResponseDto",
        "type": "object",
        "properties": {
          "status": {
            "type": "number",
            "description": "Upstream HTTP status code"
          },
          "body": {
            "description": "Parsed JSON when the response is JSON, else the raw text"
          }
        },
        "required": [
          "status",
          "body"
        ],
        "additionalProperties": false
      },
      "AgentAvailability": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/AgentAvailability",
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "user_id": {
            "type": "number"
          },
          "organization_id": {
            "type": "string"
          },
          "is_available": {
            "type": "boolean"
          },
          "custom_status": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "last_status_change": {
            "type": "string",
            "format": "date-time"
          },
          "current_chat_count": {
            "type": "number"
          },
          "max_concurrent_chats": {
            "type": "number"
          },
          "notes": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "call_available": {
            "type": "boolean"
          },
          "call_locked": {
            "type": "boolean"
          },
          "call_wrap_up_until": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "call_wrap_up_started_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "call_wrap_up_phone_call_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "availability_status_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "user_id",
          "organization_id",
          "is_available",
          "custom_status",
          "last_status_change",
          "current_chat_count",
          "max_concurrent_chats",
          "notes",
          "created_at",
          "updated_at",
          "call_available",
          "call_locked",
          "call_wrap_up_until",
          "call_wrap_up_phone_call_id",
          "availability_status_id"
        ],
        "additionalProperties": false
      },
      "AuditLogPublicDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/AuditLogPublicDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "org_id": {
            "type": "string"
          },
          "actor_id": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "actor_type": {
            "type": "string",
            "enum": [
              "api",
              "system",
              "user"
            ]
          },
          "actor_email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "actor_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "api_key": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AuditLogApiKeyActorDto"
              },
              {
                "type": "null"
              }
            ]
          },
          "entity_type": {
            "type": "string"
          },
          "entity_id": {
            "type": "string"
          },
          "event_type": {
            "type": "string"
          },
          "event_category": {
            "type": "string",
            "enum": [
              "access",
              "agent_availability",
              "communication",
              "configuration",
              "data",
              "security"
            ]
          },
          "changes": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "before": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "anyOf": [
                        {},
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "after": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "anyOf": [
                        {},
                        {
                          "type": "null"
                        }
                      ]
                    }
                  }
                },
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "metadata": {
            "anyOf": [
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "anyOf": [
                    {},
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "ip_address": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "user_agent": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "org_id",
          "actor_id",
          "actor_type",
          "actor_email",
          "actor_name",
          "api_key",
          "entity_type",
          "entity_id",
          "event_type",
          "event_category",
          "changes",
          "metadata",
          "created_at",
          "ip_address",
          "user_agent"
        ],
        "additionalProperties": false
      },
      "AuditLogsPublicResponse": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/AuditLogsPublicResponse",
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AuditLogPublicDto"
            }
          },
          "pagination": {
            "type": "object",
            "properties": {
              "total": {
                "type": "number"
              },
              "page": {
                "type": "number"
              },
              "limit": {
                "type": "number"
              },
              "totalPages": {
                "type": "number"
              }
            },
            "required": [
              "total",
              "page",
              "limit",
              "totalPages"
            ],
            "additionalProperties": false
          },
          "next_cursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Pass as `cursor` to fetch the next page; null on the last page."
          }
        },
        "required": [
          "data",
          "pagination",
          "next_cursor"
        ],
        "additionalProperties": false
      },
      "ResolvedAvailabilityStatusDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ResolvedAvailabilityStatusDto",
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "custom",
                "description": "A defined availability status is applied"
              },
              "status_id": {
                "type": "string",
                "description": "Id of the applied availability status"
              },
              "name": {
                "type": "string",
                "description": "Name of the applied availability status"
              },
              "availability_type": {
                "type": "string",
                "enum": [
                  "offline",
                  "online"
                ],
                "description": "Whether the applied status sets the agent online or offline"
              },
              "color": {
                "type": "string",
                "enum": [
                  "blue",
                  "gray",
                  "green",
                  "orange",
                  "red"
                ],
                "description": "Display color configured on the applied status"
              }
            },
            "required": [
              "kind",
              "status_id",
              "name",
              "availability_type",
              "color"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "online",
                "description": "Main availability on and available on every support team"
              },
              "color": {
                "type": "string",
                "enum": [
                  "blue",
                  "gray",
                  "green",
                  "orange",
                  "red"
                ],
                "description": "Always 'green' — the fixed color of the derived online state"
              }
            },
            "required": [
              "kind",
              "color"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "offline",
                "description": "Main availability off"
              },
              "color": {
                "type": "string",
                "enum": [
                  "blue",
                  "gray",
                  "green",
                  "orange",
                  "red"
                ],
                "description": "Always 'gray' — the fixed color of the derived offline state"
              }
            },
            "required": [
              "kind",
              "color"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "mixed",
                "description": "Main availability on but only available on some support teams"
              },
              "color": {
                "type": "string",
                "enum": [
                  "blue",
                  "gray",
                  "green",
                  "orange",
                  "red"
                ],
                "description": "Always 'green' — mixed is an online-related state"
              },
              "available_teams": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "name"
                  ],
                  "additionalProperties": false
                },
                "description": "Support teams the user is currently available on"
              }
            },
            "required": [
              "kind",
              "color",
              "available_teams"
            ],
            "additionalProperties": false
          }
        ]
      },
      "UserAvailabilityStatusDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UserAvailabilityStatusDto",
        "type": "object",
        "properties": {
          "availability": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "user_id": {
                "type": "number"
              },
              "organization_id": {
                "type": "string"
              },
              "is_available": {
                "type": "boolean"
              },
              "custom_status": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "last_status_change": {
                "type": "string",
                "format": "date-time"
              },
              "current_chat_count": {
                "type": "number"
              },
              "max_concurrent_chats": {
                "type": "number"
              },
              "notes": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "created_at": {
                "type": "string",
                "format": "date-time"
              },
              "updated_at": {
                "type": "string",
                "format": "date-time"
              },
              "call_available": {
                "type": "boolean"
              },
              "call_locked": {
                "type": "boolean"
              },
              "call_wrap_up_until": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "call_wrap_up_started_at": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "call_wrap_up_phone_call_id": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "availability_status_id": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "id",
              "user_id",
              "organization_id",
              "is_available",
              "custom_status",
              "last_status_change",
              "current_chat_count",
              "max_concurrent_chats",
              "notes",
              "created_at",
              "updated_at",
              "call_available",
              "call_locked",
              "call_wrap_up_until",
              "call_wrap_up_phone_call_id",
              "availability_status_id"
            ],
            "additionalProperties": false,
            "description": "The user's raw availability record"
          },
          "resolved_status": {
            "$ref": "#/components/schemas/ResolvedAvailabilityStatusDto"
          },
          "teams": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "available": {
                  "type": "boolean"
                }
              },
              "required": [
                "id",
                "name",
                "available"
              ],
              "additionalProperties": false
            },
            "description": "The user's full per-support-team availability switch matrix"
          }
        },
        "required": [
          "availability",
          "resolved_status",
          "teams"
        ],
        "additionalProperties": false
      },
      "ChatMessageSender": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ChatMessageSender",
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "contact"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "type"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "ai"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "type"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "human_agent"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "type"
            ],
            "additionalProperties": false
          }
        ]
      },
      "PublicChatAttachment": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/PublicChatAttachment",
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "size": {
            "type": "number"
          },
          "type": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "size",
          "type",
          "url"
        ],
        "additionalProperties": false
      },
      "ChatHistoryOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ChatHistoryOutput",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "created_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              }
            ]
          },
          "event": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "session_merged"
                  },
                  "internal": {
                    "type": "boolean",
                    "const": true
                  },
                  "merge": {
                    "type": "object",
                    "properties": {
                      "merge_id": {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                      },
                      "source_session_id": {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                      },
                      "source_ticket_number": {
                        "type": "number"
                      },
                      "primary_session_id": {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                      },
                      "primary_ticket_number": {
                        "type": "number"
                      },
                      "actor": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "const": "agent"
                              },
                              "agentId": {
                                "type": "number"
                              }
                            },
                            "required": [
                              "type",
                              "agentId"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "const": "api"
                              }
                            },
                            "required": [
                              "type"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      },
                      "redacted": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "merge_id",
                      "source_session_id",
                      "source_ticket_number",
                      "primary_session_id",
                      "primary_ticket_number",
                      "actor"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "type",
                  "internal",
                  "merge"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "merged_session_message"
                  },
                  "internal": {
                    "type": "boolean",
                    "const": true
                  },
                  "source": {
                    "type": "object",
                    "properties": {
                      "merge_id": {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                      },
                      "source_session_id": {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                      },
                      "source_ticket_number": {
                        "type": "number"
                      },
                      "source_message_uuid": {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                      },
                      "redacted": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "merge_id",
                      "source_session_id",
                      "source_ticket_number",
                      "source_message_uuid"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "type",
                  "internal",
                  "source"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "unmapped_event",
                    "description": "A recorded event without a typed history mapping. Included in organization exports so no history rows are lost."
                  },
                  "message_type": {
                    "type": "string",
                    "enum": [
                      "agent_assigned_by_integration",
                      "agent_assigned_by_system",
                      "agent_assigned_by_user",
                      "agent_changed",
                      "agent_comment",
                      "agent_initiated_session",
                      "agent_joined",
                      "agent_message",
                      "agent_message_deleted_by_agent",
                      "agent_reopened_session",
                      "agent_took_session_from_ai",
                      "agent_unassigned_by_integration",
                      "agent_unassigned_by_system",
                      "agent_unassigned_by_user",
                      "ai_assumed_the_session_resolved",
                      "ai_decided_to_not_reply",
                      "ai_decided_to_resolve_the_issue",
                      "ai_follow_up_cancelled",
                      "ai_follow_up_fired",
                      "ai_follow_up_scheduled",
                      "ai_reopened_session",
                      "ai_response_cancelled",
                      "ai_resumed_by_system",
                      "ai_suggestion",
                      "call_history",
                      "call_transferred",
                      "closed_resolved_by_agent",
                      "closed_resolved_by_api",
                      "closed_resolved_by_contact",
                      "closed_resolved_by_integration",
                      "closed_resolved_by_system",
                      "closed_unresolved_by_agent",
                      "closed_unresolved_by_api",
                      "closed_unresolved_by_system",
                      "contact_data_updated",
                      "csat_request_cancelled",
                      "csat_requested",
                      "csat_submitted",
                      "email_draft_message",
                      "handoff",
                      "handoff_to_salesforce_miaw",
                      "handoff_to_third_party_failed",
                      "handoff_to_zendesk",
                      "integration_reopened_session",
                      "ivr_selection",
                      "merged_session_message",
                      "message",
                      "pii_attachment_removed",
                      "primary_contact_changed",
                      "prohibited_topic_detected",
                      "quoted_content_modified",
                      "salesforce_fields_updated",
                      "sequence_message",
                      "session_forwarded",
                      "session_language_changed_by_agent",
                      "session_language_changed_by_api",
                      "session_language_changed_by_integration",
                      "session_language_changed_by_system",
                      "session_merged",
                      "session_priority_changed_by_agent",
                      "session_priority_changed_by_system",
                      "session_snoozed",
                      "session_subject_changed_by_system",
                      "session_unsnoozed",
                      "skills_added_by_system",
                      "sla_applied_by_agent",
                      "sla_applied_by_system",
                      "sla_first_reply_breached",
                      "sla_first_reply_completed_after_breach",
                      "sla_first_reply_fulfilled",
                      "sla_first_reply_metric_started",
                      "sla_freezed_office_hours_ended",
                      "sla_freezed_snoozed",
                      "sla_next_reply_breached",
                      "sla_next_reply_completed_after_breach",
                      "sla_next_reply_fulfilled",
                      "sla_next_reply_metric_started",
                      "sla_removed_by_agent",
                      "sla_removed_by_system",
                      "sla_resolution_breached",
                      "sla_resolution_completed_after_breach",
                      "sla_resolution_fulfilled",
                      "sla_resolution_metric_started",
                      "sla_resolution_paused_resolved",
                      "sla_resolution_paused_waiting_on_customer",
                      "sla_resolution_resumed_customer_replied",
                      "sla_resolution_resumed_reopened",
                      "sla_resumed_office_hours_started",
                      "sla_resumed_snooze_cancelled",
                      "sla_resumed_snooze_expired",
                      "state_checkpoint",
                      "sub_session_created",
                      "sub_session_linked_by_agent",
                      "sub_session_linked_by_api",
                      "sub_session_linked_by_integration",
                      "sub_session_linked_by_system",
                      "sub_session_unlinked_by_agent",
                      "sub_session_unlinked_by_api",
                      "sub_session_unlinked_by_integration",
                      "sub_session_unlinked_by_system",
                      "sub_status_removed_by_agent",
                      "sub_status_removed_by_api",
                      "sub_status_removed_by_integration",
                      "sub_status_removed_by_system",
                      "sub_status_set_by_agent",
                      "sub_status_set_by_api",
                      "sub_status_set_by_integration",
                      "sub_status_set_by_system",
                      "system_reopened_session",
                      "tag_added_by_agent",
                      "tag_added_by_api",
                      "tag_added_by_integration",
                      "tag_added_by_system",
                      "tag_removed_by_agent",
                      "tag_removed_by_api",
                      "tag_removed_by_integration",
                      "tag_removed_by_system",
                      "team_assigned_by_integration",
                      "team_assigned_by_system",
                      "team_assigned_by_user",
                      "team_unassigned_by_integration",
                      "team_unassigned_by_system",
                      "team_unassigned_by_user",
                      "user_confirmed_the_session_resolved",
                      "voice_call_ai_joined",
                      "voice_call_ai_left",
                      "voice_call_contact_answered",
                      "voice_call_contact_joined",
                      "voice_call_contact_left",
                      "voice_call_ended",
                      "voice_call_failed_to_start",
                      "voice_call_human_answered",
                      "voice_call_human_joined",
                      "voice_call_human_left",
                      "voice_call_started",
                      "workflow_message",
                      "workflow_note",
                      "workflow_triggered"
                    ]
                  },
                  "content": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "text"
                          },
                          "text": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "type",
                          "text"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "type",
                  "message_type",
                  "content"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "ai_comment",
                    "description": "An internal note authored by AI."
                  },
                  "content": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "const": "text"
                      },
                      "text": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "type",
                      "text"
                    ],
                    "additionalProperties": false
                  },
                  "comment_thread_id": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "type",
                  "content",
                  "comment_thread_id"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "message"
                  },
                  "sender": {
                    "$ref": "#/components/schemas/ChatMessageSender"
                  },
                  "content": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "const": "text"
                      },
                      "text": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "type",
                      "text"
                    ],
                    "additionalProperties": false
                  },
                  "context": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  "custom_data": {
                    "description": "Custom data attached to this message by the sender (e.g. via the widget SDK)",
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  "attachments": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/PublicChatAttachment"
                    }
                  },
                  "options": {
                    "description": "Agent messages sent from a macro with options: the options the contact can tap. Report a tap with `message.option_reply` on Send a message.",
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/MessageOptionDto"
                    }
                  }
                },
                "required": [
                  "type",
                  "sender",
                  "content",
                  "attachments"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "ai_suggestion",
                    "description": "An AI draft reply produced in assist mode — suggested to the human support team, never delivered to the contact."
                  },
                  "content": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "const": "text"
                      },
                      "text": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "type",
                      "text"
                    ],
                    "additionalProperties": false
                  },
                  "attachments": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/PublicChatAttachment"
                    }
                  }
                },
                "required": [
                  "type",
                  "content",
                  "attachments"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "workflow_message"
                  },
                  "workflow_id": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "workflow_run_id": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "content": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "const": "text"
                      },
                      "text": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "type",
                      "text"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "type",
                  "workflow_id",
                  "workflow_run_id",
                  "content"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "sequence_message"
                  },
                  "sequence_id": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "content": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "const": "text"
                      },
                      "text": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "type",
                      "text"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "type",
                  "sequence_id",
                  "content"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "handoff"
                  },
                  "integration": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "zendesk",
                          "salesforce-miaw"
                        ]
                      }
                    },
                    "required": [
                      "type"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "type"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "closed_resolved_by_agent"
                  }
                },
                "required": [
                  "type"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "closed_resolved_by_system"
                  }
                },
                "required": [
                  "type"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "closed_resolved_by_api"
                  }
                },
                "required": [
                  "type"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "closed_unresolved_by_agent"
                  }
                },
                "required": [
                  "type"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "closed_unresolved_by_system"
                  }
                },
                "required": [
                  "type"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "closed_unresolved_by_api"
                  }
                },
                "required": [
                  "type"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "closed_resolved_by_contact"
                  }
                },
                "required": [
                  "type"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "closed_resolved_by_integration"
                  }
                },
                "required": [
                  "type"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "sub_status_set_by_agent"
                  },
                  "sub_status_id": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "type",
                  "sub_status_id"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "sub_status_set_by_system"
                  },
                  "sub_status_id": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "type",
                  "sub_status_id"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "sub_status_set_by_api"
                  },
                  "sub_status_id": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "type",
                  "sub_status_id"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "sub_status_removed_by_agent"
                  },
                  "sub_status_id": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "type",
                  "sub_status_id"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "sub_status_removed_by_system"
                  },
                  "sub_status_id": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "type",
                  "sub_status_id"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "sub_status_removed_by_api"
                  },
                  "sub_status_id": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "type",
                  "sub_status_id"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "sub_status_set_by_integration"
                  },
                  "sub_status_id": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "type",
                  "sub_status_id"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "sub_status_removed_by_integration"
                  },
                  "sub_status_id": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "type",
                  "sub_status_id"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "tag_added_by_system",
                      "tag_added_by_agent",
                      "tag_added_by_api",
                      "tag_added_by_integration",
                      "tag_removed_by_system",
                      "tag_removed_by_agent",
                      "tag_removed_by_api",
                      "tag_removed_by_integration"
                    ]
                  },
                  "tags": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "name"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "type",
                  "tags"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "ai_resolved_issue"
                  }
                },
                "required": [
                  "type"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "ai_assumed_issue_resolved"
                  }
                },
                "required": [
                  "type"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "user_confirmed_issue_resolved"
                  }
                },
                "required": [
                  "type"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "human_agent_comment"
                  },
                  "human_agent_id": {
                    "type": "number"
                  },
                  "content": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "const": "text"
                      },
                      "text": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "type",
                      "text"
                    ],
                    "additionalProperties": false
                  },
                  "comment_thread_id": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "type",
                  "human_agent_id",
                  "content",
                  "comment_thread_id"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "workflow_note"
                  },
                  "workflow_id": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "workflow_run_id": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "content": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "const": "text"
                      },
                      "text": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "type",
                      "text"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "type",
                  "workflow_id",
                  "workflow_run_id",
                  "content"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "human_agent_joined"
                  },
                  "human_agent_id": {
                    "type": "number"
                  }
                },
                "required": [
                  "type",
                  "human_agent_id"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "human_agent_takeover"
                  },
                  "human_agent_id": {
                    "type": "number"
                  }
                },
                "required": [
                  "type",
                  "human_agent_id"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "human_agent_reopened_session"
                  },
                  "human_agent_id": {
                    "type": "number"
                  }
                },
                "required": [
                  "type",
                  "human_agent_id"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "system_reopened_session"
                  },
                  "workflow_id": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "workflow_run_id": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "type",
                  "workflow_id",
                  "workflow_run_id"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "integration_reopened_session"
                  }
                },
                "required": [
                  "type"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "ai_reopened_session"
                  }
                },
                "required": [
                  "type"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "state_checkpoint"
                  },
                  "payload": {}
                },
                "required": [
                  "type",
                  "payload"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "csat_requested"
                  }
                },
                "required": [
                  "type"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "csat_submitted"
                  },
                  "payload": {
                    "type": "object",
                    "properties": {
                      "score": {
                        "type": "number"
                      },
                      "feedback": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "score",
                      "feedback"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "type",
                  "payload"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "agent_changed"
                  }
                },
                "required": [
                  "type"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "prohibited_topic_detected"
                  },
                  "topic": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "type",
                  "topic"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "agent_assigned_by_system"
                  },
                  "assigned_agent_id": {
                    "type": "number"
                  }
                },
                "required": [
                  "type"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "agent_assigned_by_integration"
                  },
                  "assigned_agent_id": {
                    "type": "number"
                  }
                },
                "required": [
                  "type"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "agent_assigned_by_user"
                  },
                  "assigned_agent_id": {
                    "type": "number"
                  },
                  "actor_id": {
                    "type": "number"
                  }
                },
                "required": [
                  "type"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "agent_unassigned_by_system"
                  },
                  "unassigned_agent_id": {
                    "type": "number"
                  }
                },
                "required": [
                  "type"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "agent_unassigned_by_integration"
                  },
                  "unassigned_agent_id": {
                    "type": "number"
                  }
                },
                "required": [
                  "type"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "agent_unassigned_by_user"
                  },
                  "unassigned_agent_id": {
                    "type": "number"
                  },
                  "actor_id": {
                    "type": "number"
                  }
                },
                "required": [
                  "type"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "team_assigned_by_system"
                  },
                  "assigned_team_id": {
                    "type": "string"
                  }
                },
                "required": [
                  "type"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "team_assigned_by_integration"
                  },
                  "assigned_team_id": {
                    "type": "string"
                  }
                },
                "required": [
                  "type"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "team_assigned_by_user"
                  },
                  "assigned_team_id": {
                    "type": "string"
                  },
                  "actor_id": {
                    "type": "number"
                  }
                },
                "required": [
                  "type"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "team_unassigned_by_system"
                  },
                  "unassigned_team_id": {
                    "type": "string"
                  }
                },
                "required": [
                  "type"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "team_unassigned_by_integration"
                  },
                  "unassigned_team_id": {
                    "type": "string"
                  }
                },
                "required": [
                  "type"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "team_unassigned_by_user"
                  },
                  "unassigned_team_id": {
                    "type": "string"
                  },
                  "actor_id": {
                    "type": "number"
                  }
                },
                "required": [
                  "type"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "sla_applied_by_system",
                      "sla_applied_by_agent",
                      "sla_removed_by_agent",
                      "sla_removed_by_system",
                      "sla_first_reply_metric_started",
                      "sla_first_reply_fulfilled",
                      "sla_first_reply_breached",
                      "sla_first_reply_completed_after_breach",
                      "sla_next_reply_metric_started",
                      "sla_next_reply_fulfilled",
                      "sla_next_reply_breached",
                      "sla_next_reply_completed_after_breach",
                      "sla_resolution_metric_started",
                      "sla_resolution_paused_waiting_on_customer",
                      "sla_resolution_paused_resolved",
                      "sla_resolution_resumed_customer_replied",
                      "sla_resolution_resumed_reopened",
                      "sla_resolution_fulfilled",
                      "sla_resolution_breached",
                      "sla_resolution_completed_after_breach",
                      "sla_freezed_office_hours_ended",
                      "sla_resumed_office_hours_started",
                      "sla_freezed_snoozed",
                      "sla_resumed_snooze_expired",
                      "sla_resumed_snooze_cancelled"
                    ]
                  },
                  "elapsed_ms": {
                    "anyOf": [
                      {
                        "type": "number"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "type",
                  "elapsed_ms"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "workflow_triggered"
                  },
                  "workflow_id": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "workflow_run_id": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "type",
                  "workflow_id",
                  "workflow_run_id"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "contact_data_updated"
                  },
                  "fields": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "type",
                  "fields"
                ],
                "additionalProperties": false
              }
            ]
          }
        },
        "required": [
          "id",
          "created_at",
          "event"
        ],
        "additionalProperties": false
      },
      "SessionEventsPublicResponse": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SessionEventsPublicResponse",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "created_at": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                    }
                  ]
                },
                "event": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "session_merged"
                        },
                        "internal": {
                          "type": "boolean",
                          "const": true
                        },
                        "merge": {
                          "type": "object",
                          "properties": {
                            "merge_id": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                            },
                            "source_session_id": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                            },
                            "source_ticket_number": {
                              "type": "number"
                            },
                            "primary_session_id": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                            },
                            "primary_ticket_number": {
                              "type": "number"
                            },
                            "actor": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "agent"
                                    },
                                    "agentId": {
                                      "type": "number"
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "agentId"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "api"
                                    }
                                  },
                                  "required": [
                                    "type"
                                  ],
                                  "additionalProperties": false
                                }
                              ]
                            },
                            "redacted": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "merge_id",
                            "source_session_id",
                            "source_ticket_number",
                            "primary_session_id",
                            "primary_ticket_number",
                            "actor"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "type",
                        "internal",
                        "merge"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "merged_session_message"
                        },
                        "internal": {
                          "type": "boolean",
                          "const": true
                        },
                        "source": {
                          "type": "object",
                          "properties": {
                            "merge_id": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                            },
                            "source_session_id": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                            },
                            "source_ticket_number": {
                              "type": "number"
                            },
                            "source_message_uuid": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                            },
                            "redacted": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "merge_id",
                            "source_session_id",
                            "source_ticket_number",
                            "source_message_uuid"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "type",
                        "internal",
                        "source"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "unmapped_event",
                          "description": "A recorded event without a typed history mapping. Included in organization exports so no history rows are lost."
                        },
                        "message_type": {
                          "type": "string",
                          "enum": [
                            "agent_assigned_by_integration",
                            "agent_assigned_by_system",
                            "agent_assigned_by_user",
                            "agent_changed",
                            "agent_comment",
                            "agent_initiated_session",
                            "agent_joined",
                            "agent_message",
                            "agent_message_deleted_by_agent",
                            "agent_reopened_session",
                            "agent_took_session_from_ai",
                            "agent_unassigned_by_integration",
                            "agent_unassigned_by_system",
                            "agent_unassigned_by_user",
                            "ai_assumed_the_session_resolved",
                            "ai_decided_to_not_reply",
                            "ai_decided_to_resolve_the_issue",
                            "ai_follow_up_cancelled",
                            "ai_follow_up_fired",
                            "ai_follow_up_scheduled",
                            "ai_reopened_session",
                            "ai_response_cancelled",
                            "ai_resumed_by_system",
                            "ai_suggestion",
                            "call_history",
                            "call_transferred",
                            "closed_resolved_by_agent",
                            "closed_resolved_by_api",
                            "closed_resolved_by_contact",
                            "closed_resolved_by_integration",
                            "closed_resolved_by_system",
                            "closed_unresolved_by_agent",
                            "closed_unresolved_by_api",
                            "closed_unresolved_by_system",
                            "contact_data_updated",
                            "csat_request_cancelled",
                            "csat_requested",
                            "csat_submitted",
                            "email_draft_message",
                            "handoff",
                            "handoff_to_salesforce_miaw",
                            "handoff_to_third_party_failed",
                            "handoff_to_zendesk",
                            "integration_reopened_session",
                            "ivr_selection",
                            "merged_session_message",
                            "message",
                            "pii_attachment_removed",
                            "primary_contact_changed",
                            "prohibited_topic_detected",
                            "quoted_content_modified",
                            "salesforce_fields_updated",
                            "sequence_message",
                            "session_forwarded",
                            "session_language_changed_by_agent",
                            "session_language_changed_by_api",
                            "session_language_changed_by_integration",
                            "session_language_changed_by_system",
                            "session_merged",
                            "session_priority_changed_by_agent",
                            "session_priority_changed_by_system",
                            "session_snoozed",
                            "session_subject_changed_by_system",
                            "session_unsnoozed",
                            "skills_added_by_system",
                            "sla_applied_by_agent",
                            "sla_applied_by_system",
                            "sla_first_reply_breached",
                            "sla_first_reply_completed_after_breach",
                            "sla_first_reply_fulfilled",
                            "sla_first_reply_metric_started",
                            "sla_freezed_office_hours_ended",
                            "sla_freezed_snoozed",
                            "sla_next_reply_breached",
                            "sla_next_reply_completed_after_breach",
                            "sla_next_reply_fulfilled",
                            "sla_next_reply_metric_started",
                            "sla_removed_by_agent",
                            "sla_removed_by_system",
                            "sla_resolution_breached",
                            "sla_resolution_completed_after_breach",
                            "sla_resolution_fulfilled",
                            "sla_resolution_metric_started",
                            "sla_resolution_paused_resolved",
                            "sla_resolution_paused_waiting_on_customer",
                            "sla_resolution_resumed_customer_replied",
                            "sla_resolution_resumed_reopened",
                            "sla_resumed_office_hours_started",
                            "sla_resumed_snooze_cancelled",
                            "sla_resumed_snooze_expired",
                            "state_checkpoint",
                            "sub_session_created",
                            "sub_session_linked_by_agent",
                            "sub_session_linked_by_api",
                            "sub_session_linked_by_integration",
                            "sub_session_linked_by_system",
                            "sub_session_unlinked_by_agent",
                            "sub_session_unlinked_by_api",
                            "sub_session_unlinked_by_integration",
                            "sub_session_unlinked_by_system",
                            "sub_status_removed_by_agent",
                            "sub_status_removed_by_api",
                            "sub_status_removed_by_integration",
                            "sub_status_removed_by_system",
                            "sub_status_set_by_agent",
                            "sub_status_set_by_api",
                            "sub_status_set_by_integration",
                            "sub_status_set_by_system",
                            "system_reopened_session",
                            "tag_added_by_agent",
                            "tag_added_by_api",
                            "tag_added_by_integration",
                            "tag_added_by_system",
                            "tag_removed_by_agent",
                            "tag_removed_by_api",
                            "tag_removed_by_integration",
                            "tag_removed_by_system",
                            "team_assigned_by_integration",
                            "team_assigned_by_system",
                            "team_assigned_by_user",
                            "team_unassigned_by_integration",
                            "team_unassigned_by_system",
                            "team_unassigned_by_user",
                            "user_confirmed_the_session_resolved",
                            "voice_call_ai_joined",
                            "voice_call_ai_left",
                            "voice_call_contact_answered",
                            "voice_call_contact_joined",
                            "voice_call_contact_left",
                            "voice_call_ended",
                            "voice_call_failed_to_start",
                            "voice_call_human_answered",
                            "voice_call_human_joined",
                            "voice_call_human_left",
                            "voice_call_started",
                            "workflow_message",
                            "workflow_note",
                            "workflow_triggered"
                          ]
                        },
                        "content": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "const": "text"
                                },
                                "text": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "type",
                                "text"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "type",
                        "message_type",
                        "content"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "ai_comment",
                          "description": "An internal note authored by AI."
                        },
                        "content": {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "text"
                            },
                            "text": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "type",
                            "text"
                          ],
                          "additionalProperties": false
                        },
                        "comment_thread_id": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "type",
                        "content",
                        "comment_thread_id"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "message"
                        },
                        "sender": {
                          "$ref": "#/components/schemas/ChatMessageSender"
                        },
                        "content": {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "text"
                            },
                            "text": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "type",
                            "text"
                          ],
                          "additionalProperties": false
                        },
                        "context": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {}
                        },
                        "custom_data": {
                          "description": "Custom data attached to this message by the sender (e.g. via the widget SDK)",
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {}
                        },
                        "attachments": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/PublicChatAttachment"
                          }
                        },
                        "options": {
                          "description": "Agent messages sent from a macro with options: the options the contact can tap. Report a tap with `message.option_reply` on Send a message.",
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/MessageOptionDto"
                          }
                        }
                      },
                      "required": [
                        "type",
                        "sender",
                        "content",
                        "attachments"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "ai_suggestion",
                          "description": "An AI draft reply produced in assist mode — suggested to the human support team, never delivered to the contact."
                        },
                        "content": {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "text"
                            },
                            "text": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "type",
                            "text"
                          ],
                          "additionalProperties": false
                        },
                        "attachments": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/PublicChatAttachment"
                          }
                        }
                      },
                      "required": [
                        "type",
                        "content",
                        "attachments"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "workflow_message"
                        },
                        "workflow_id": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "workflow_run_id": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "content": {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "text"
                            },
                            "text": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "type",
                            "text"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "type",
                        "workflow_id",
                        "workflow_run_id",
                        "content"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "sequence_message"
                        },
                        "sequence_id": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "content": {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "text"
                            },
                            "text": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "type",
                            "text"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "type",
                        "sequence_id",
                        "content"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "handoff"
                        },
                        "integration": {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": [
                                "zendesk",
                                "salesforce-miaw"
                              ]
                            }
                          },
                          "required": [
                            "type"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "closed_resolved_by_agent"
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "closed_resolved_by_system"
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "closed_resolved_by_api"
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "closed_unresolved_by_agent"
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "closed_unresolved_by_system"
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "closed_unresolved_by_api"
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "closed_resolved_by_contact"
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "closed_resolved_by_integration"
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "sub_status_set_by_agent"
                        },
                        "sub_status_id": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "type",
                        "sub_status_id"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "sub_status_set_by_system"
                        },
                        "sub_status_id": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "type",
                        "sub_status_id"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "sub_status_set_by_api"
                        },
                        "sub_status_id": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "type",
                        "sub_status_id"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "sub_status_removed_by_agent"
                        },
                        "sub_status_id": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "type",
                        "sub_status_id"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "sub_status_removed_by_system"
                        },
                        "sub_status_id": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "type",
                        "sub_status_id"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "sub_status_removed_by_api"
                        },
                        "sub_status_id": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "type",
                        "sub_status_id"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "sub_status_set_by_integration"
                        },
                        "sub_status_id": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "type",
                        "sub_status_id"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "sub_status_removed_by_integration"
                        },
                        "sub_status_id": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "type",
                        "sub_status_id"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "tag_added_by_system",
                            "tag_added_by_agent",
                            "tag_added_by_api",
                            "tag_added_by_integration",
                            "tag_removed_by_system",
                            "tag_removed_by_agent",
                            "tag_removed_by_api",
                            "tag_removed_by_integration"
                          ]
                        },
                        "tags": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "name"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "type",
                        "tags"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "ai_resolved_issue"
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "ai_assumed_issue_resolved"
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "user_confirmed_issue_resolved"
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "human_agent_comment"
                        },
                        "human_agent_id": {
                          "type": "number"
                        },
                        "content": {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "text"
                            },
                            "text": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "type",
                            "text"
                          ],
                          "additionalProperties": false
                        },
                        "comment_thread_id": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "type",
                        "human_agent_id",
                        "content",
                        "comment_thread_id"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "workflow_note"
                        },
                        "workflow_id": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "workflow_run_id": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "content": {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "text"
                            },
                            "text": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "type",
                            "text"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "type",
                        "workflow_id",
                        "workflow_run_id",
                        "content"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "human_agent_joined"
                        },
                        "human_agent_id": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "type",
                        "human_agent_id"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "human_agent_takeover"
                        },
                        "human_agent_id": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "type",
                        "human_agent_id"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "human_agent_reopened_session"
                        },
                        "human_agent_id": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "type",
                        "human_agent_id"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "system_reopened_session"
                        },
                        "workflow_id": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "workflow_run_id": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "type",
                        "workflow_id",
                        "workflow_run_id"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "integration_reopened_session"
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "ai_reopened_session"
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "state_checkpoint"
                        },
                        "payload": {}
                      },
                      "required": [
                        "type",
                        "payload"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "csat_requested"
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "csat_submitted"
                        },
                        "payload": {
                          "type": "object",
                          "properties": {
                            "score": {
                              "type": "number"
                            },
                            "feedback": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "score",
                            "feedback"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "type",
                        "payload"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "agent_changed"
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "prohibited_topic_detected"
                        },
                        "topic": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "type",
                        "topic"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "agent_assigned_by_system"
                        },
                        "assigned_agent_id": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "agent_assigned_by_integration"
                        },
                        "assigned_agent_id": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "agent_assigned_by_user"
                        },
                        "assigned_agent_id": {
                          "type": "number"
                        },
                        "actor_id": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "agent_unassigned_by_system"
                        },
                        "unassigned_agent_id": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "agent_unassigned_by_integration"
                        },
                        "unassigned_agent_id": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "agent_unassigned_by_user"
                        },
                        "unassigned_agent_id": {
                          "type": "number"
                        },
                        "actor_id": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "team_assigned_by_system"
                        },
                        "assigned_team_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "team_assigned_by_integration"
                        },
                        "assigned_team_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "team_assigned_by_user"
                        },
                        "assigned_team_id": {
                          "type": "string"
                        },
                        "actor_id": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "team_unassigned_by_system"
                        },
                        "unassigned_team_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "team_unassigned_by_integration"
                        },
                        "unassigned_team_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "team_unassigned_by_user"
                        },
                        "unassigned_team_id": {
                          "type": "string"
                        },
                        "actor_id": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "sla_applied_by_system",
                            "sla_applied_by_agent",
                            "sla_removed_by_agent",
                            "sla_removed_by_system",
                            "sla_first_reply_metric_started",
                            "sla_first_reply_fulfilled",
                            "sla_first_reply_breached",
                            "sla_first_reply_completed_after_breach",
                            "sla_next_reply_metric_started",
                            "sla_next_reply_fulfilled",
                            "sla_next_reply_breached",
                            "sla_next_reply_completed_after_breach",
                            "sla_resolution_metric_started",
                            "sla_resolution_paused_waiting_on_customer",
                            "sla_resolution_paused_resolved",
                            "sla_resolution_resumed_customer_replied",
                            "sla_resolution_resumed_reopened",
                            "sla_resolution_fulfilled",
                            "sla_resolution_breached",
                            "sla_resolution_completed_after_breach",
                            "sla_freezed_office_hours_ended",
                            "sla_resumed_office_hours_started",
                            "sla_freezed_snoozed",
                            "sla_resumed_snooze_expired",
                            "sla_resumed_snooze_cancelled"
                          ]
                        },
                        "elapsed_ms": {
                          "anyOf": [
                            {
                              "type": "number"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "type",
                        "elapsed_ms"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "workflow_triggered"
                        },
                        "workflow_id": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "workflow_run_id": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "type",
                        "workflow_id",
                        "workflow_run_id"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "contact_data_updated"
                        },
                        "fields": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "string"
                          }
                        }
                      },
                      "required": [
                        "type",
                        "fields"
                      ],
                      "additionalProperties": false
                    }
                  ]
                },
                "session_id": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "contact_id": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "message_type": {
                  "type": "string",
                  "enum": [
                    "agent_assigned_by_integration",
                    "agent_assigned_by_system",
                    "agent_assigned_by_user",
                    "agent_changed",
                    "agent_comment",
                    "agent_initiated_session",
                    "agent_joined",
                    "agent_message",
                    "agent_message_deleted_by_agent",
                    "agent_reopened_session",
                    "agent_took_session_from_ai",
                    "agent_unassigned_by_integration",
                    "agent_unassigned_by_system",
                    "agent_unassigned_by_user",
                    "ai_assumed_the_session_resolved",
                    "ai_decided_to_not_reply",
                    "ai_decided_to_resolve_the_issue",
                    "ai_follow_up_cancelled",
                    "ai_follow_up_fired",
                    "ai_follow_up_scheduled",
                    "ai_reopened_session",
                    "ai_response_cancelled",
                    "ai_resumed_by_system",
                    "ai_suggestion",
                    "call_history",
                    "call_transferred",
                    "closed_resolved_by_agent",
                    "closed_resolved_by_api",
                    "closed_resolved_by_contact",
                    "closed_resolved_by_integration",
                    "closed_resolved_by_system",
                    "closed_unresolved_by_agent",
                    "closed_unresolved_by_api",
                    "closed_unresolved_by_system",
                    "contact_data_updated",
                    "csat_request_cancelled",
                    "csat_requested",
                    "csat_submitted",
                    "email_draft_message",
                    "handoff",
                    "handoff_to_salesforce_miaw",
                    "handoff_to_third_party_failed",
                    "handoff_to_zendesk",
                    "integration_reopened_session",
                    "ivr_selection",
                    "merged_session_message",
                    "message",
                    "pii_attachment_removed",
                    "primary_contact_changed",
                    "prohibited_topic_detected",
                    "quoted_content_modified",
                    "salesforce_fields_updated",
                    "sequence_message",
                    "session_forwarded",
                    "session_language_changed_by_agent",
                    "session_language_changed_by_api",
                    "session_language_changed_by_integration",
                    "session_language_changed_by_system",
                    "session_merged",
                    "session_priority_changed_by_agent",
                    "session_priority_changed_by_system",
                    "session_snoozed",
                    "session_subject_changed_by_system",
                    "session_unsnoozed",
                    "skills_added_by_system",
                    "sla_applied_by_agent",
                    "sla_applied_by_system",
                    "sla_first_reply_breached",
                    "sla_first_reply_completed_after_breach",
                    "sla_first_reply_fulfilled",
                    "sla_first_reply_metric_started",
                    "sla_freezed_office_hours_ended",
                    "sla_freezed_snoozed",
                    "sla_next_reply_breached",
                    "sla_next_reply_completed_after_breach",
                    "sla_next_reply_fulfilled",
                    "sla_next_reply_metric_started",
                    "sla_removed_by_agent",
                    "sla_removed_by_system",
                    "sla_resolution_breached",
                    "sla_resolution_completed_after_breach",
                    "sla_resolution_fulfilled",
                    "sla_resolution_metric_started",
                    "sla_resolution_paused_resolved",
                    "sla_resolution_paused_waiting_on_customer",
                    "sla_resolution_resumed_customer_replied",
                    "sla_resolution_resumed_reopened",
                    "sla_resumed_office_hours_started",
                    "sla_resumed_snooze_cancelled",
                    "sla_resumed_snooze_expired",
                    "state_checkpoint",
                    "sub_session_created",
                    "sub_session_linked_by_agent",
                    "sub_session_linked_by_api",
                    "sub_session_linked_by_integration",
                    "sub_session_linked_by_system",
                    "sub_session_unlinked_by_agent",
                    "sub_session_unlinked_by_api",
                    "sub_session_unlinked_by_integration",
                    "sub_session_unlinked_by_system",
                    "sub_status_removed_by_agent",
                    "sub_status_removed_by_api",
                    "sub_status_removed_by_integration",
                    "sub_status_removed_by_system",
                    "sub_status_set_by_agent",
                    "sub_status_set_by_api",
                    "sub_status_set_by_integration",
                    "sub_status_set_by_system",
                    "system_reopened_session",
                    "tag_added_by_agent",
                    "tag_added_by_api",
                    "tag_added_by_integration",
                    "tag_added_by_system",
                    "tag_removed_by_agent",
                    "tag_removed_by_api",
                    "tag_removed_by_integration",
                    "tag_removed_by_system",
                    "team_assigned_by_integration",
                    "team_assigned_by_system",
                    "team_assigned_by_user",
                    "team_unassigned_by_integration",
                    "team_unassigned_by_system",
                    "team_unassigned_by_user",
                    "user_confirmed_the_session_resolved",
                    "voice_call_ai_joined",
                    "voice_call_ai_left",
                    "voice_call_contact_answered",
                    "voice_call_contact_joined",
                    "voice_call_contact_left",
                    "voice_call_ended",
                    "voice_call_failed_to_start",
                    "voice_call_human_answered",
                    "voice_call_human_joined",
                    "voice_call_human_left",
                    "voice_call_started",
                    "workflow_message",
                    "workflow_note",
                    "workflow_triggered"
                  ],
                  "description": "Stored event type used by include/exclude filters; it can differ from the normalized event.type."
                },
                "actor": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": [
                        "human",
                        "api",
                        "workflow",
                        "system",
                        "integration",
                        "ai",
                        "contact",
                        "unknown"
                      ]
                    },
                    "id": {
                      "type": "string"
                    },
                    "workflow_run_id": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type"
                  ],
                  "additionalProperties": false
                },
                "details": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "target": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": [
                                "human",
                                "ai",
                                "team",
                                "none"
                              ]
                            },
                            "id": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "sub_status_id": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workflow_id": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workflow_run_id": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "edited_at": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "deleted_at": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "message",
                    "target",
                    "sub_status_id",
                    "workflow_id",
                    "workflow_run_id",
                    "edited_at",
                    "deleted_at"
                  ],
                  "additionalProperties": false
                }
              },
              "required": [
                "id",
                "created_at",
                "event",
                "session_id",
                "contact_id",
                "message_type",
                "actor",
                "details"
              ],
              "additionalProperties": false
            }
          },
          "next": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "items",
          "next"
        ],
        "additionalProperties": false
      },
      "SaveContactOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SaveContactOutput",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          }
        },
        "additionalProperties": false
      },
      "Contact": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/Contact",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "primary_external_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The main account's external_id within your organization, or null when unlinked. The main contact may not exist yet. Set through external-ID widget authentication; contact create/update endpoints do not accept this field."
          },
          "email": {
            "anyOf": [
              {
                "type": "string",
                "format": "email",
                "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "phone_number": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "custom_data": {
            "anyOf": [
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": "string"
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "non_verified_custom_data": {
            "anyOf": [
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": "string"
                }
              },
              {
                "type": "null"
              }
            ],
            "description": "Custom data from unverified sources (e.g. an unauthenticated widget visitor), kept apart from custom_data"
          },
          "created_at": {
            "type": "string",
            "description": "ISO 8601 timestamp of when the contact was created"
          },
          "updated_at": {
            "type": "string",
            "description": "ISO 8601 timestamp of when the contact was last updated"
          }
        },
        "required": [
          "id",
          "primary_external_id",
          "email",
          "phone_number",
          "name",
          "custom_data",
          "non_verified_custom_data",
          "created_at",
          "updated_at"
        ],
        "additionalProperties": false
      },
      "InvestigationContact": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/InvestigationContact",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "primary_external_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The main account's external_id within your organization, or null when unlinked. The main contact may not exist yet. Set through external-ID widget authentication; contact create/update endpoints do not accept this field."
          },
          "email": {
            "anyOf": [
              {
                "type": "string",
                "format": "email",
                "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "phone_number": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "custom_data": {
            "anyOf": [
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": "string"
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "non_verified_custom_data": {
            "anyOf": [
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "number"
                    },
                    {
                      "type": "boolean"
                    }
                  ]
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "type": "string",
            "description": "ISO 8601 timestamp of when the contact was created"
          },
          "updated_at": {
            "type": "string",
            "description": "ISO 8601 timestamp of when the contact was last updated"
          },
          "non_verified_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "non_verified_email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "primary_external_id",
          "email",
          "phone_number",
          "name",
          "custom_data",
          "non_verified_custom_data",
          "created_at",
          "updated_at",
          "non_verified_name",
          "non_verified_email"
        ],
        "additionalProperties": false
      },
      "InvestigationAssignee": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/InvestigationAssignee",
        "type": "object",
        "properties": {
          "id": {
            "type": "number"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "email": {
            "anyOf": [
              {
                "type": "string",
                "format": "email",
                "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "avatar_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "name",
          "email",
          "avatar_url"
        ],
        "additionalProperties": false
      },
      "InvestigationTeam": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/InvestigationTeam",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "name",
          "description"
        ],
        "additionalProperties": false
      },
      "InvestigationTicketingSystem": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/InvestigationTicketingSystem",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "enum": [
              "dynamics365",
              "freshchat",
              "freshdesk",
              "freshdesk_ticketing",
              "front",
              "gorgias",
              "hubspot",
              "infobip",
              "intercom",
              "open",
              "salesforce",
              "salesforce_v2",
              "twilio_flex",
              "zendesk",
              "zendesk_v2"
            ]
          },
          "external_id": {
            "type": "string"
          },
          "id_type": {
            "type": "string",
            "enum": [
              "conversation_id",
              "ticket_id",
              "case_id",
              "conversation_sid"
            ]
          }
        },
        "required": [
          "name",
          "external_id",
          "id_type"
        ],
        "additionalProperties": false
      },
      "InvestigationSessionSummary": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/InvestigationSessionSummary",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "ticket_number": {
            "type": "number"
          },
          "status": {
            "type": "string",
            "enum": [
              "open",
              "closed_resolved",
              "closed_unresolved"
            ]
          },
          "ai_closure_type": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "assumed_resolved",
                  "handed_off",
                  "resolved"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "sentiment": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "angry",
                  "happy",
                  "neutral"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "channel": {
            "type": "object",
            "properties": {
              "type": {
                "$ref": "#/components/schemas/SessionChannel"
              }
            },
            "required": [
              "type"
            ],
            "additionalProperties": false
          },
          "assist_mode": {
            "type": "boolean"
          },
          "language": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "contact": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/InvestigationContact"
              },
              {
                "type": "null"
              }
            ]
          },
          "team": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/InvestigationTeam"
              },
              {
                "type": "null"
              }
            ]
          },
          "assignee": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/InvestigationAssignee"
              },
              {
                "type": "null"
              }
            ]
          },
          "ticketing_system": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/InvestigationTicketingSystem"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "ticket_number",
          "status",
          "ai_closure_type",
          "sentiment",
          "channel",
          "assist_mode",
          "language",
          "created_at",
          "updated_at",
          "contact",
          "team",
          "assignee",
          "ticketing_system"
        ],
        "additionalProperties": false
      },
      "InvestigationHistoryItem": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/InvestigationHistoryItem",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "event_type": {
            "type": "string"
          },
          "sender_type": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "contact",
                  "ai",
                  "human_agent"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "sender_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "text": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "created_at",
          "event_type",
          "sender_type",
          "sender_name",
          "text"
        ],
        "additionalProperties": false
      },
      "InvestigationHistoryStats": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/InvestigationHistoryStats",
        "type": "object",
        "properties": {
          "total_events_loaded": {
            "type": "number"
          },
          "last_customer_message_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "last_ai_message_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "last_human_message_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "total_events_loaded",
          "last_customer_message_at",
          "last_ai_message_at",
          "last_human_message_at"
        ],
        "additionalProperties": false
      },
      "InvestigationReferenceItem": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/InvestigationReferenceItem",
        "type": "object",
        "properties": {
          "reference_type": {
            "type": "string",
            "enum": [
              "ai_profile",
              "instruction",
              "knowledge",
              "prohibited_topic",
              "tool"
            ]
          },
          "reference_id": {
            "type": "string"
          }
        },
        "required": [
          "reference_type",
          "reference_id"
        ],
        "additionalProperties": false
      },
      "InvestigationReferenceBuckets": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/InvestigationReferenceBuckets",
        "type": "object",
        "properties": {
          "knowledge": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "tools": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "instructions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "ai_profile": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "prohibited_topics": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "knowledge",
          "tools",
          "instructions",
          "ai_profile",
          "prohibited_topics"
        ],
        "additionalProperties": false
      },
      "InvestigationHandoff": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/InvestigationHandoff",
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "created_at": {
                "type": "string",
                "format": "date-time"
              },
              "summary": {
                "type": "string"
              },
              "explanation": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "sentiment": {
                "anyOf": [
                  {
                    "type": "string",
                    "enum": [
                      "angry",
                      "happy",
                      "neutral"
                    ]
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "reasons": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "ai_implied_handoff",
                    "based_on_instructions",
                    "feature_limit_reached__ai_resolutions",
                    "feature_limit_reached__ai_voice_minutes",
                    "instructions_not_clear",
                    "insufficient_knowledge",
                    "insufficient_tools",
                    "prohibited_topic",
                    "user_requested_human_assistance"
                  ]
                }
              },
              "references": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/InvestigationReferenceItem"
                }
              },
              "referenced_documents": {
                "$ref": "#/components/schemas/InvestigationReferenceBuckets"
              }
            },
            "required": [
              "id",
              "created_at",
              "summary",
              "explanation",
              "sentiment",
              "reasons",
              "references",
              "referenced_documents"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "InvestigationTag": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/InvestigationTag",
        "type": "object",
        "properties": {
          "tag_name": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "tag_name",
          "created_at"
        ],
        "additionalProperties": false
      },
      "InvestigationCsat": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/InvestigationCsat",
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "score": {
                "type": "number"
              },
              "comment": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "channel": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "created_at": {
                "type": "string",
                "format": "date-time"
              },
              "updated_at": {
                "type": "string",
                "format": "date-time"
              }
            },
            "required": [
              "id",
              "score",
              "comment",
              "channel",
              "created_at",
              "updated_at"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "InvestigationDiagnostic": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/InvestigationDiagnostic",
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "missing_instruction_or_coverage_gap",
              "missing_action_or_tool",
              "unclear_instruction",
              "escalation_rule_triggered",
              "user_requested_human",
              "prohibited_topic_guardrail"
            ]
          },
          "confidence": {
            "type": "string",
            "enum": [
              "low",
              "medium",
              "high"
            ]
          },
          "evidence": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "code",
          "confidence",
          "evidence"
        ],
        "additionalProperties": false
      },
      "ChatSessionInvestigationPublicResponse": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ChatSessionInvestigationPublicResponse",
        "type": "object",
        "properties": {
          "session": {
            "$ref": "#/components/schemas/InvestigationSessionSummary"
          },
          "recent_history": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvestigationHistoryItem"
            }
          },
          "history_stats": {
            "$ref": "#/components/schemas/InvestigationHistoryStats"
          },
          "handoff": {
            "$ref": "#/components/schemas/InvestigationHandoff"
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvestigationTag"
            }
          },
          "csat": {
            "$ref": "#/components/schemas/InvestigationCsat"
          },
          "diagnostics": {
            "type": "object",
            "properties": {
              "handed_off": {
                "type": "boolean"
              },
              "likely_root_causes": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/InvestigationDiagnostic"
                }
              },
              "missing_data": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "handed_off",
              "likely_root_causes",
              "missing_data"
            ],
            "additionalProperties": false
          },
          "generated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "session",
          "recent_history",
          "history_stats",
          "handoff",
          "tags",
          "csat",
          "diagnostics",
          "generated_at"
        ],
        "additionalProperties": false
      },
      "CreateChatSessionOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CreateChatSessionOutput",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          }
        },
        "required": [
          "id"
        ],
        "additionalProperties": false
      },
      "SessionTagOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SessionTagOutput",
        "type": "object",
        "properties": {
          "tag_name": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "tag_name",
          "created_at"
        ],
        "additionalProperties": false
      },
      "ChatSessionAssignee": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ChatSessionAssignee",
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "human"
              },
              "id": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991,
                "description": "Human user ID, matching the numeric ID in GET /users."
              },
              "name": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Current organization display name, matching GET /users, or null if the user is no longer a member of this organization or cannot be found. The recorded human ID is retained."
              }
            },
            "required": [
              "type",
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "ai"
              }
            },
            "required": [
              "type"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "none"
              }
            },
            "required": [
              "type"
            ],
            "additionalProperties": false
          }
        ],
        "description": "Current session assignment. AI and unassigned sessions have no assignee ID."
      },
      "GetChatSessionOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/GetChatSessionOutput",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "merge": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  "primary_session_id": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "merged_at": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "id",
                  "primary_session_id",
                  "merged_at"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SessionTagOutput"
            },
            "description": "All tags currently assigned to this session, ordered by tag name. Empty when no tags are assigned."
          },
          "status": {
            "type": "string",
            "enum": [
              "open",
              "closed_resolved",
              "closed_unresolved"
            ]
          },
          "sub_status_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Id of the custom status refining `status`, or null when only the built-in status applies. Resolve it with GET /custom-statuses."
          },
          "ai_closure_type": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "assumed_resolved",
                  "handed_off",
                  "resolved"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "sentiment": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "angry",
                  "happy",
                  "neutral"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "summary": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "AI-generated summary of the conversation. Populated for both AI-resolved and handed-off sessions once the session has been summarized; null otherwise."
          },
          "title": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Session title: the email subject, a subject set by an agent, or an AI-generated title. Null until one is set."
          },
          "channel": {
            "type": "object",
            "properties": {
              "type": {
                "$ref": "#/components/schemas/SessionChannel"
              }
            },
            "required": [
              "type"
            ],
            "additionalProperties": false
          },
          "contact": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "primary_external_id": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "The main account's external_id within your organization, or null when unlinked. The main contact may not exist yet. Set through external-ID widget authentication; contact create/update endpoints do not accept this field."
              },
              "email": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "email",
                    "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "phone_number": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "name": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "custom_data": {
                "anyOf": [
                  {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "type": "string"
                    }
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "non_verified_custom_data": {
                "anyOf": [
                  {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "number"
                        },
                        {
                          "type": "boolean"
                        }
                      ]
                    }
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "created_at": {
                "type": "string",
                "description": "ISO 8601 timestamp of when the contact was created"
              },
              "updated_at": {
                "type": "string",
                "description": "ISO 8601 timestamp of when the contact was last updated"
              },
              "non_verified_name": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "non_verified_email": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "id",
              "primary_external_id",
              "email",
              "phone_number",
              "name",
              "custom_data",
              "non_verified_custom_data",
              "created_at",
              "updated_at",
              "non_verified_name",
              "non_verified_email"
            ],
            "additionalProperties": false
          },
          "language": {
            "type": "string"
          },
          "assignee_id": {
            "description": "Deprecated: use assignee. Contains the recorded human user ID as a string, or null for AI and unassigned sessions. Use assignee.type to distinguish them. This deprecation applies only to response fields; assignment requests still accept assignee_id.",
            "deprecated": true,
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "assignee": {
            "$ref": "#/components/schemas/ChatSessionAssignee"
          },
          "custom_data": {
            "description": "Session-level custom data stored on the chat session.",
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "number"
                },
                {
                  "type": "boolean"
                }
              ]
            }
          },
          "team": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "name": {
                "type": "string"
              },
              "description": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "support_team": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                    "description": "Stable team ID, preserved when the team is renamed."
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ],
            "description": "Support team assigned to this session. Null when no team can be resolved within the session organization."
          },
          "handoff": {
            "type": "object",
            "properties": {
              "sentiment": {
                "type": "string",
                "enum": [
                  "angry",
                  "happy",
                  "neutral"
                ]
              },
              "summary": {
                "type": "string"
              }
            },
            "required": [
              "summary"
            ],
            "additionalProperties": false
          },
          "ticketing_system": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "enum": [
                  "dynamics365",
                  "freshchat",
                  "freshdesk",
                  "freshdesk_ticketing",
                  "front",
                  "gorgias",
                  "hubspot",
                  "infobip",
                  "intercom",
                  "open",
                  "salesforce",
                  "salesforce_v2",
                  "twilio_flex",
                  "zendesk",
                  "zendesk_v2"
                ]
              },
              "external_id": {
                "type": "string"
              },
              "id_type": {
                "type": "string",
                "enum": [
                  "conversation_id",
                  "ticket_id",
                  "case_id",
                  "conversation_sid"
                ]
              }
            },
            "required": [
              "name",
              "external_id",
              "id_type"
            ],
            "additionalProperties": false
          },
          "ticket_number": {
            "type": "number"
          },
          "assist_mode": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "first_human_message_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "Timestamp of the first recorded human reply to this session. Null when no human reply has been recorded."
          }
        },
        "required": [
          "id",
          "merge",
          "tags",
          "status",
          "sub_status_id",
          "ai_closure_type",
          "sentiment",
          "summary",
          "title",
          "channel",
          "assignee",
          "support_team",
          "ticket_number",
          "assist_mode",
          "created_at",
          "updated_at",
          "first_human_message_at"
        ],
        "additionalProperties": false
      },
      "GetChatSessionDetailOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/GetChatSessionDetailOutput",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "merge": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  "primary_session_id": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "merged_at": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "id",
                  "primary_session_id",
                  "merged_at"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SessionTagOutput"
            },
            "description": "All tags currently assigned to this session, ordered by tag name. Empty when no tags are assigned."
          },
          "status": {
            "type": "string",
            "enum": [
              "open",
              "closed_resolved",
              "closed_unresolved"
            ]
          },
          "sub_status_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Id of the custom status refining `status`, or null when only the built-in status applies. Resolve it with GET /custom-statuses."
          },
          "ai_closure_type": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "assumed_resolved",
                  "handed_off",
                  "resolved"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "sentiment": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "angry",
                  "happy",
                  "neutral"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "summary": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "AI-generated summary of the conversation. Populated for both AI-resolved and handed-off sessions once the session has been summarized; null otherwise."
          },
          "title": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Session title: the email subject, a subject set by an agent, or an AI-generated title. Null until one is set."
          },
          "channel": {
            "type": "object",
            "properties": {
              "type": {
                "$ref": "#/components/schemas/SessionChannel"
              }
            },
            "required": [
              "type"
            ],
            "additionalProperties": false
          },
          "contact": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "primary_external_id": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "The main account's external_id within your organization, or null when unlinked. The main contact may not exist yet. Set through external-ID widget authentication; contact create/update endpoints do not accept this field."
              },
              "email": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "email",
                    "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "phone_number": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "name": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "custom_data": {
                "anyOf": [
                  {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "type": "string"
                    }
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "non_verified_custom_data": {
                "anyOf": [
                  {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "number"
                        },
                        {
                          "type": "boolean"
                        }
                      ]
                    }
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "created_at": {
                "type": "string",
                "description": "ISO 8601 timestamp of when the contact was created"
              },
              "updated_at": {
                "type": "string",
                "description": "ISO 8601 timestamp of when the contact was last updated"
              },
              "non_verified_name": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "non_verified_email": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "id",
              "primary_external_id",
              "email",
              "phone_number",
              "name",
              "custom_data",
              "non_verified_custom_data",
              "created_at",
              "updated_at",
              "non_verified_name",
              "non_verified_email"
            ],
            "additionalProperties": false
          },
          "language": {
            "type": "string"
          },
          "assignee_id": {
            "description": "Deprecated: use assignee. Contains the recorded human user ID as a string, or null for AI and unassigned sessions. Use assignee.type to distinguish them. This deprecation applies only to response fields; assignment requests still accept assignee_id.",
            "deprecated": true,
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "assignee": {
            "$ref": "#/components/schemas/ChatSessionAssignee"
          },
          "custom_data": {
            "description": "Session-level custom data stored on the chat session.",
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "number"
                },
                {
                  "type": "boolean"
                }
              ]
            }
          },
          "team": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "name": {
                "type": "string"
              },
              "description": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "support_team": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                    "description": "Stable team ID, preserved when the team is renamed."
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ],
            "description": "Support team assigned to this session. Null when no team can be resolved within the session organization."
          },
          "handoff": {
            "type": "object",
            "properties": {
              "sentiment": {
                "type": "string",
                "enum": [
                  "angry",
                  "happy",
                  "neutral"
                ]
              },
              "summary": {
                "type": "string"
              }
            },
            "required": [
              "summary"
            ],
            "additionalProperties": false
          },
          "ticketing_system": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "enum": [
                  "dynamics365",
                  "freshchat",
                  "freshdesk",
                  "freshdesk_ticketing",
                  "front",
                  "gorgias",
                  "hubspot",
                  "infobip",
                  "intercom",
                  "open",
                  "salesforce",
                  "salesforce_v2",
                  "twilio_flex",
                  "zendesk",
                  "zendesk_v2"
                ]
              },
              "external_id": {
                "type": "string"
              },
              "id_type": {
                "type": "string",
                "enum": [
                  "conversation_id",
                  "ticket_id",
                  "case_id",
                  "conversation_sid"
                ]
              }
            },
            "required": [
              "name",
              "external_id",
              "id_type"
            ],
            "additionalProperties": false
          },
          "ticket_number": {
            "type": "number"
          },
          "assist_mode": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "first_human_message_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "Timestamp of the first recorded human reply to this session. Null when no human reply has been recorded."
          },
          "recording_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Download link for the latest completed call recording in a phone or web session, or null when unavailable. Valid for seven days; fetch this session again to refresh it. Available only when getting a session by ID."
          }
        },
        "required": [
          "id",
          "merge",
          "tags",
          "status",
          "sub_status_id",
          "ai_closure_type",
          "sentiment",
          "summary",
          "title",
          "channel",
          "assignee",
          "support_team",
          "ticket_number",
          "assist_mode",
          "created_at",
          "updated_at",
          "first_human_message_at",
          "recording_url"
        ],
        "additionalProperties": false
      },
      "SessionAssigneeUpdateOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SessionAssigneeUpdateOutput",
        "type": "object",
        "properties": {
          "no_change": {
            "type": "boolean"
          },
          "session": {
            "$ref": "#/components/schemas/GetChatSessionOutput"
          }
        },
        "required": [
          "no_change",
          "session"
        ],
        "additionalProperties": false
      },
      "HandoffSessionOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/HandoffSessionOutput",
        "type": "object",
        "properties": {
          "session": {
            "$ref": "#/components/schemas/GetChatSessionOutput"
          }
        },
        "required": [
          "session"
        ],
        "additionalProperties": false
      },
      "SessionTeamTransferOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SessionTeamTransferOutput",
        "type": "object",
        "properties": {
          "no_change": {
            "type": "boolean"
          },
          "session": {
            "$ref": "#/components/schemas/GetChatSessionOutput"
          }
        },
        "required": [
          "no_change",
          "session"
        ],
        "additionalProperties": false
      },
      "SessionTagMutationOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SessionTagMutationOutput",
        "type": "object",
        "properties": {
          "session_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SessionTagOutput"
            }
          }
        },
        "required": [
          "session_id",
          "tags"
        ],
        "additionalProperties": false
      },
      "SendMessageOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SendMessageOutput",
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "data": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "message": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "message"
                ],
                "additionalProperties": false
              },
              {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "success": {
                        "type": "boolean",
                        "const": true
                      },
                      "code": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "string",
                            "const": "session_assigned_to_human_agent"
                          },
                          {
                            "type": "string",
                            "const": "response_cancelled"
                          },
                          {
                            "type": "string",
                            "const": "skipping_unuseful_response"
                          },
                          {
                            "type": "string",
                            "const": "duplicate_message_ignored"
                          },
                          {
                            "type": "string",
                            "const": "ai_response_skipped_by_workflow"
                          },
                          {
                            "type": "string",
                            "const": "message_option_workflow_triggered"
                          },
                          {
                            "type": "string",
                            "const": "ai_skipped_spam"
                          },
                          {
                            "type": "string",
                            "const": "ai_awaiting_option_tap"
                          },
                          {
                            "type": "string",
                            "const": "steered_into_live_turn"
                          },
                          {
                            "type": "string",
                            "const": "session_busy"
                          },
                          {
                            "type": "string",
                            "const": "feature_limit_reached"
                          }
                        ]
                      },
                      "autopilotResponse": {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "text"
                          },
                          "value": {
                            "type": "object",
                            "properties": {
                              "error": {
                                "type": "boolean"
                              },
                              "content": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "error",
                              "content"
                            ],
                            "additionalProperties": false
                          },
                          "id": {
                            "type": "string"
                          },
                          "mightSolveUserIssue": {
                            "type": "boolean"
                          },
                          "completelyAndFullyCoveredUserIssue": {
                            "type": "boolean"
                          },
                          "debugInfo": {
                            "type": "object",
                            "properties": {
                              "actionCalls": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "callId": {
                                      "type": "string"
                                    },
                                    "action": {
                                      "type": "object",
                                      "properties": {
                                        "name": {
                                          "type": "string"
                                        },
                                        "id": {
                                          "type": "string"
                                        },
                                        "openapi": {
                                          "type": "object",
                                          "properties": {
                                            "openapi_spec_id": {
                                              "type": "string"
                                            },
                                            "operation_spec": {},
                                            "operation_id": {
                                              "type": "string"
                                            },
                                            "operation_method": {
                                              "type": "string"
                                            }
                                          },
                                          "required": [
                                            "operation_spec"
                                          ],
                                          "additionalProperties": false
                                        },
                                        "metadata": {},
                                        "required_form_submission": {
                                          "type": "boolean"
                                        },
                                        "is_handoff_like": {
                                          "type": "boolean"
                                        }
                                      },
                                      "required": [
                                        "name",
                                        "id",
                                        "metadata"
                                      ],
                                      "additionalProperties": false
                                    },
                                    "arguments": {},
                                    "result": {}
                                  },
                                  "required": [
                                    "action",
                                    "arguments",
                                    "result"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "actionSearchQuery": {
                                "type": "string"
                              },
                              "knowledge": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "source": {
                                      "type": "string"
                                    },
                                    "source_type": {
                                      "type": "string"
                                    },
                                    "url": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "source",
                                    "source_type",
                                    "url"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "knowledge_used": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "content": {
                                      "type": "string"
                                    },
                                    "source": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "content",
                                    "source"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "work_instructions_scanned": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "content": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "content"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "client_context": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "propertyNames": {
                                      "type": "string"
                                    },
                                    "additionalProperties": {}
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "Context provided from the client. For example, dynamic metadata sent from the widget such as: the current product name on the page, the current Shopify shop domain, etc etc."
                              },
                              "additional_debug_data": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "propertyNames": {
                                      "type": "string"
                                    },
                                    "additionalProperties": {}
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "Org-specific or message-type-specific debug data."
                              },
                              "custom_data": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "propertyNames": {
                                      "type": "string"
                                    },
                                    "additionalProperties": {}
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "whatsapp_template_request": {
                                "anyOf": [
                                  {},
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "assist_mode": {
                                "type": "boolean"
                              },
                              "whatsapp_template_snapshot": {
                                "anyOf": [
                                  {},
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "message_options": {
                                "anyOf": [
                                  {},
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "rule_violation_reflections": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "rule_name": {
                                      "type": "string"
                                    },
                                    "violation_description": {
                                      "type": "string",
                                      "description": "How the rule was violated"
                                    }
                                  },
                                  "required": [
                                    "rule_name",
                                    "violation_description"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "tool_call_results_quick_reply_suggestions": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "tool_name": {
                                      "type": "string"
                                    },
                                    "suggestions": {
                                      "type": "array",
                                      "items": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "required": [
                                    "tool_name",
                                    "suggestions"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "assignment_choice_summary": {
                                "default": null,
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "strategy": {
                                        "type": "string",
                                        "const": "least-busy"
                                      },
                                      "selected": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "agent_id": {
                                                "type": "number"
                                              },
                                              "agent_name": {
                                                "type": "string"
                                              },
                                              "active_sessions": {
                                                "type": "number"
                                              },
                                              "active_sessions_in_group": {
                                                "type": "number"
                                              },
                                              "pending_sessions": {
                                                "type": "number"
                                              },
                                              "remaining_capacity": {
                                                "type": "number"
                                              },
                                              "max_capacity": {
                                                "type": "number"
                                              },
                                              "max_capacity_in_group": {
                                                "anyOf": [
                                                  {
                                                    "type": "number"
                                                  },
                                                  {
                                                    "type": "null"
                                                  }
                                                ]
                                              },
                                              "is_available_globally": {
                                                "type": "boolean"
                                              },
                                              "is_available_in_group": {
                                                "type": "boolean"
                                              },
                                              "missing_required_skills": {
                                                "default": [],
                                                "type": "array",
                                                "items": {
                                                  "type": "object",
                                                  "properties": {
                                                    "id": {
                                                      "type": "string"
                                                    },
                                                    "name": {
                                                      "type": "string"
                                                    }
                                                  },
                                                  "required": [
                                                    "id",
                                                    "name"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              },
                                              "pacing_until": {
                                                "default": null,
                                                "anyOf": [
                                                  {
                                                    "type": "string"
                                                  },
                                                  {
                                                    "type": "null"
                                                  }
                                                ]
                                              },
                                              "skip_reason": {
                                                "default": null,
                                                "anyOf": [
                                                  {
                                                    "type": "string",
                                                    "enum": [
                                                      "pacing"
                                                    ]
                                                  },
                                                  {
                                                    "type": "null"
                                                  }
                                                ]
                                              }
                                            },
                                            "required": [
                                              "agent_id",
                                              "agent_name",
                                              "active_sessions",
                                              "active_sessions_in_group",
                                              "pending_sessions",
                                              "remaining_capacity",
                                              "max_capacity",
                                              "max_capacity_in_group",
                                              "is_available_globally",
                                              "is_available_in_group",
                                              "missing_required_skills",
                                              "pacing_until",
                                              "skip_reason"
                                            ],
                                            "additionalProperties": false
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "peers": {
                                        "type": "array",
                                        "items": {
                                          "type": "object",
                                          "properties": {
                                            "agent_id": {
                                              "type": "number"
                                            },
                                            "agent_name": {
                                              "type": "string"
                                            },
                                            "active_sessions": {
                                              "type": "number"
                                            },
                                            "active_sessions_in_group": {
                                              "type": "number"
                                            },
                                            "pending_sessions": {
                                              "type": "number"
                                            },
                                            "remaining_capacity": {
                                              "type": "number"
                                            },
                                            "max_capacity": {
                                              "type": "number"
                                            },
                                            "max_capacity_in_group": {
                                              "anyOf": [
                                                {
                                                  "type": "number"
                                                },
                                                {
                                                  "type": "null"
                                                }
                                              ]
                                            },
                                            "is_available_globally": {
                                              "type": "boolean"
                                            },
                                            "is_available_in_group": {
                                              "type": "boolean"
                                            },
                                            "missing_required_skills": {
                                              "default": [],
                                              "type": "array",
                                              "items": {
                                                "type": "object",
                                                "properties": {
                                                  "id": {
                                                    "type": "string"
                                                  },
                                                  "name": {
                                                    "type": "string"
                                                  }
                                                },
                                                "required": [
                                                  "id",
                                                  "name"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "pacing_until": {
                                              "default": null,
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "null"
                                                }
                                              ]
                                            },
                                            "skip_reason": {
                                              "default": null,
                                              "anyOf": [
                                                {
                                                  "type": "string",
                                                  "enum": [
                                                    "pacing"
                                                  ]
                                                },
                                                {
                                                  "type": "null"
                                                }
                                              ]
                                            }
                                          },
                                          "required": [
                                            "agent_id",
                                            "agent_name",
                                            "active_sessions",
                                            "active_sessions_in_group",
                                            "pending_sessions",
                                            "remaining_capacity",
                                            "max_capacity",
                                            "max_capacity_in_group",
                                            "is_available_globally",
                                            "is_available_in_group",
                                            "missing_required_skills",
                                            "pacing_until",
                                            "skip_reason"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required_skills": {
                                        "default": [],
                                        "type": "array",
                                        "items": {
                                          "type": "object",
                                          "properties": {
                                            "id": {
                                              "type": "string"
                                            },
                                            "name": {
                                              "type": "string"
                                            }
                                          },
                                          "required": [
                                            "id",
                                            "name"
                                          ],
                                          "additionalProperties": false
                                        }
                                      }
                                    },
                                    "required": [
                                      "strategy",
                                      "selected",
                                      "peers",
                                      "required_skills"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "integration_actor": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "system": {
                                        "type": "string",
                                        "enum": [
                                          "intercom"
                                        ]
                                      },
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "admin",
                                          "bot",
                                          "team",
                                          "workflow",
                                          "balanced",
                                          "unknown"
                                        ]
                                      },
                                      "name": {
                                        "anyOf": [
                                          {
                                            "type": "string"
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "external_id": {
                                        "anyOf": [
                                          {
                                            "type": "string"
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "part_type": {
                                        "anyOf": [
                                          {
                                            "type": "string"
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "open_cx_user_id": {
                                        "anyOf": [
                                          {
                                            "type": "number"
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      }
                                    },
                                    "required": [
                                      "system",
                                      "kind",
                                      "name",
                                      "external_id"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "destination_id": {
                                "type": "string"
                              },
                              "destination_name": {
                                "type": "string"
                              },
                              "destination_type": {
                                "type": "string",
                                "enum": [
                                  "hangup",
                                  "phone",
                                  "sip",
                                  "team"
                                ]
                              },
                              "transfer_reason": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "is_failover": {
                                "type": "boolean"
                              },
                              "failover_source": {
                                "type": "string",
                                "enum": [
                                  "stt",
                                  "llm",
                                  "tts"
                                ]
                              },
                              "hangup_initiator": {
                                "type": "string",
                                "enum": [
                                  "user",
                                  "agent",
                                  "system"
                                ]
                              },
                              "hangup_reason": {
                                "type": "string"
                              },
                              "duration_seconds": {
                                "type": "number"
                              },
                              "call_direction": {
                                "type": "string",
                                "enum": [
                                  "inbound",
                                  "outbound"
                                ]
                              },
                              "voice_call": {
                                "type": "object",
                                "properties": {
                                  "source": {
                                    "type": "string",
                                    "enum": [
                                      "backend",
                                      "livekit",
                                      "voice_worker",
                                      "twilio",
                                      "vapi"
                                    ]
                                  },
                                  "occurrence_id": {
                                    "type": "string"
                                  },
                                  "failure": {
                                    "type": "object",
                                    "properties": {
                                      "stage": {
                                        "type": "string",
                                        "enum": [
                                          "dispatch",
                                          "sip",
                                          "provider"
                                        ]
                                      },
                                      "code": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "stage",
                                      "code"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "participant": {
                                    "type": "object",
                                    "properties": {
                                      "id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      },
                                      "userId": {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "maximum": 9007199254740991
                                      },
                                      "phoneNumber": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "id"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "required": [
                                  "source"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "additionalProperties": false
                          },
                          "assistMode": {
                            "type": "boolean"
                          },
                          "emailContactRevision": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "emailDelivered": {
                            "type": "boolean"
                          },
                          "mode": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "slug": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "didExitMode": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "type",
                          "value",
                          "mightSolveUserIssue",
                          "completelyAndFullyCoveredUserIssue",
                          "assistMode"
                        ],
                        "additionalProperties": false
                      },
                      "uiResponse": {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "ui"
                          },
                          "value": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "const": "ui_component"
                              },
                              "request_response": {},
                              "name": {
                                "type": "string"
                              },
                              "content": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "type",
                              "request_response",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "mightSolveUserIssue": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "type",
                          "value",
                          "mightSolveUserIssue"
                        ],
                        "additionalProperties": false
                      },
                      "sessionIsHandedOff": {
                        "type": "boolean"
                      },
                      "steeredIntoTurnId": {
                        "type": "string"
                      },
                      "workflowRunIds": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "resolveArgs": {
                        "type": "object",
                        "properties": {
                          "summary": {
                            "type": "string",
                            "description": "Summary of the conversation with the user to be viewed by a human agent."
                          },
                          "sentiment": {
                            "type": "string",
                            "enum": [
                              "angry",
                              "happy",
                              "neutral"
                            ]
                          }
                        },
                        "required": [
                          "summary",
                          "sentiment"
                        ],
                        "additionalProperties": false
                      },
                      "toolCallResultsQuickReplySuggestions": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "tool_name": {
                              "type": "string"
                            },
                            "suggestions": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            }
                          },
                          "required": [
                            "tool_name",
                            "suggestions"
                          ],
                          "additionalProperties": false
                        }
                      }
                    },
                    "required": [
                      "success"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "success": {
                        "type": "boolean",
                        "const": false
                      },
                      "error": {
                        "type": "object",
                        "properties": {
                          "code": {
                            "type": "string"
                          },
                          "message": {
                            "type": "string"
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "required": [
                      "success",
                      "error"
                    ],
                    "additionalProperties": false
                  }
                ]
              }
            ]
          }
        },
        "required": [
          "success",
          "data"
        ],
        "additionalProperties": false
      },
      "ChatSessionFollowUpOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ChatSessionFollowUpOutput",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Follow-up id — stable across the follow-up’s lifetime"
          },
          "session_id": {
            "type": "string"
          },
          "ticket_number": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "prompt": {
            "type": "string"
          },
          "fire_at": {
            "description": "When the follow-up fires (UTC)",
            "type": "string",
            "format": "date-time"
          },
          "repeat": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "every_minutes": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "times": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "every_minutes",
                  "times"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "is_active": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "session_id",
          "ticket_number",
          "prompt",
          "fire_at",
          "repeat",
          "is_active",
          "created_at"
        ],
        "additionalProperties": false
      },
      "ChatSessionFollowUpListOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ChatSessionFollowUpListOutput",
        "type": "object",
        "properties": {
          "follow_ups": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ChatSessionFollowUpOutput"
            }
          },
          "limits": {
            "type": "object",
            "properties": {
              "max_active_per_session": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "max_total_per_session": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "max_active_per_session",
              "max_total_per_session"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "follow_ups",
          "limits"
        ],
        "additionalProperties": false
      },
      "ContactSegment": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ContactSegment",
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "definition": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "or": {
                    "minItems": 1,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "and": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/ContactsFilter"
                          }
                        }
                      },
                      "required": [
                        "and"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "or"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "ISO 8601 timestamp of when the segment was created"
          },
          "updated_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "ISO 8601 timestamp of when the segment was last updated"
          }
        },
        "required": [
          "id",
          "name",
          "description",
          "definition",
          "created_at",
          "updated_at"
        ],
        "additionalProperties": false
      },
      "ListContactSegmentsOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ListContactSegmentsOutput",
        "type": "object",
        "properties": {
          "total": {
            "type": "number"
          },
          "page": {
            "type": "number"
          },
          "limit": {
            "type": "number"
          },
          "totalPages": {
            "type": "number"
          },
          "hasNextPage": {
            "type": "boolean"
          },
          "hasPrevPage": {
            "type": "boolean"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContactSegment"
            }
          }
        },
        "required": [
          "total",
          "page",
          "limit",
          "totalPages",
          "hasNextPage",
          "hasPrevPage",
          "data"
        ],
        "additionalProperties": false
      },
      "CheckContactInSegmentOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CheckContactInSegmentOutput",
        "type": "object",
        "properties": {
          "is_member": {
            "type": "boolean"
          }
        },
        "required": [
          "is_member"
        ],
        "additionalProperties": false
      },
      "ListSegmentsForContactOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ListSegmentsForContactOutput",
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContactSegment"
            }
          }
        },
        "required": [
          "data"
        ],
        "additionalProperties": false
      },
      "CrawlDatasource": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CrawlDatasource",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "url": {
            "type": "string"
          },
          "display_name": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "page_limit": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "exclude_paths": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "include_paths": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "crawl_interval_hours": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "restricted_to_channels": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SessionChannel"
            },
            "description": "Channels this datasource is restricted to. Empty = available on all channels."
          },
          "last_crawl_started_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "last_crawl_completed_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "error_message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "auth_configured": {
            "type": "boolean",
            "description": "Whether optional Firecrawl site auth is configured. Secrets are never returned."
          },
          "auth_type": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "basic",
                  "bearer",
                  "cookie",
                  "headers"
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "Configured auth type, or null when auth is not set."
          }
        },
        "required": [
          "id",
          "url",
          "display_name",
          "status",
          "page_limit",
          "exclude_paths",
          "include_paths",
          "crawl_interval_hours",
          "restricted_to_channels",
          "last_crawl_started_at",
          "last_crawl_completed_at",
          "error_message",
          "created_at",
          "updated_at",
          "auth_configured",
          "auth_type"
        ],
        "additionalProperties": false
      },
      "CrawlDatasourceListItem": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CrawlDatasourceListItem",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "url": {
            "type": "string"
          },
          "display_name": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "page_limit": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "exclude_paths": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "include_paths": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "crawl_interval_hours": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "restricted_to_channels": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SessionChannel"
            },
            "description": "Channels this datasource is restricted to. Empty = available on all channels."
          },
          "last_crawl_started_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "last_crawl_completed_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "error_message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "auth_configured": {
            "type": "boolean",
            "description": "Whether optional Firecrawl site auth is configured. Secrets are never returned."
          },
          "auth_type": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "basic",
                  "bearer",
                  "cookie",
                  "headers"
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "Configured auth type, or null when auth is not set."
          },
          "page_count": {
            "type": "number"
          }
        },
        "required": [
          "id",
          "url",
          "display_name",
          "status",
          "page_limit",
          "exclude_paths",
          "include_paths",
          "crawl_interval_hours",
          "restricted_to_channels",
          "last_crawl_started_at",
          "last_crawl_completed_at",
          "error_message",
          "created_at",
          "updated_at",
          "auth_configured",
          "auth_type",
          "page_count"
        ],
        "additionalProperties": false
      },
      "CrawlDatasourceDetail": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CrawlDatasourceDetail",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "url": {
            "type": "string"
          },
          "display_name": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "page_limit": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "exclude_paths": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "include_paths": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "crawl_interval_hours": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "restricted_to_channels": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SessionChannel"
            },
            "description": "Channels this datasource is restricted to. Empty = available on all channels."
          },
          "last_crawl_started_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "last_crawl_completed_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "error_message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "auth_configured": {
            "type": "boolean",
            "description": "Whether optional Firecrawl site auth is configured. Secrets are never returned."
          },
          "auth_type": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "basic",
                  "bearer",
                  "cookie",
                  "headers"
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "Configured auth type, or null when auth is not set."
          },
          "page_stats": {
            "type": "object",
            "properties": {
              "total": {
                "type": "number"
              },
              "synced": {
                "type": "number"
              },
              "pending": {
                "type": "number"
              },
              "error": {
                "type": "number"
              },
              "excluded": {
                "type": "number"
              }
            },
            "required": [
              "total",
              "synced",
              "pending",
              "error",
              "excluded"
            ],
            "additionalProperties": false
          },
          "active_crawl_job": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  "status": {
                    "type": "string"
                  },
                  "total_pages": {
                    "anyOf": [
                      {
                        "type": "number"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "completed_pages": {
                    "type": "number"
                  },
                  "new_pages": {
                    "type": "number"
                  },
                  "updated_pages": {
                    "type": "number"
                  },
                  "removed_pages": {
                    "type": "number"
                  },
                  "unchanged_pages": {
                    "type": "number"
                  },
                  "started_at": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "id",
                  "status",
                  "total_pages",
                  "completed_pages",
                  "new_pages",
                  "updated_pages",
                  "removed_pages",
                  "unchanged_pages",
                  "started_at"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "url",
          "display_name",
          "status",
          "page_limit",
          "exclude_paths",
          "include_paths",
          "crawl_interval_hours",
          "restricted_to_channels",
          "last_crawl_started_at",
          "last_crawl_completed_at",
          "error_message",
          "created_at",
          "updated_at",
          "auth_configured",
          "auth_type",
          "page_stats",
          "active_crawl_job"
        ],
        "additionalProperties": false
      },
      "CrawlJob": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CrawlJob",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "datasource_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "status": {
            "type": "string"
          },
          "started_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "completed_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "total_pages": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "completed_pages": {
            "type": "number"
          },
          "new_pages": {
            "type": "number"
          },
          "updated_pages": {
            "type": "number"
          },
          "removed_pages": {
            "type": "number"
          },
          "unchanged_pages": {
            "type": "number"
          },
          "error_message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "datasource_id",
          "status",
          "started_at",
          "completed_at",
          "total_pages",
          "completed_pages",
          "new_pages",
          "updated_pages",
          "removed_pages",
          "unchanged_pages",
          "error_message",
          "created_at",
          "updated_at"
        ],
        "additionalProperties": false
      },
      "CrawlPage": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CrawlPage",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "datasource_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "url": {
            "type": "string"
          },
          "title": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "sync_status": {
            "type": "string"
          },
          "last_synced_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "error_message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "datasource_id",
          "url",
          "title",
          "sync_status",
          "last_synced_at",
          "error_message",
          "created_at",
          "updated_at"
        ],
        "additionalProperties": false
      },
      "CrawlDatasourceListResponse": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CrawlDatasourceListResponse",
        "type": "object",
        "properties": {
          "total": {
            "type": "number"
          },
          "page": {
            "type": "number"
          },
          "limit": {
            "type": "number"
          },
          "total_pages": {
            "type": "number"
          },
          "has_next_page": {
            "type": "boolean"
          },
          "has_prev_page": {
            "type": "boolean"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CrawlDatasourceListItem"
            }
          }
        },
        "required": [
          "total",
          "page",
          "limit",
          "total_pages",
          "has_next_page",
          "has_prev_page",
          "data"
        ],
        "additionalProperties": false
      },
      "CrawlJobListResponse": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CrawlJobListResponse",
        "type": "object",
        "properties": {
          "total": {
            "type": "number"
          },
          "page": {
            "type": "number"
          },
          "limit": {
            "type": "number"
          },
          "total_pages": {
            "type": "number"
          },
          "has_next_page": {
            "type": "boolean"
          },
          "has_prev_page": {
            "type": "boolean"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CrawlJob"
            }
          }
        },
        "required": [
          "total",
          "page",
          "limit",
          "total_pages",
          "has_next_page",
          "has_prev_page",
          "data"
        ],
        "additionalProperties": false
      },
      "CrawlPageListResponse": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CrawlPageListResponse",
        "type": "object",
        "properties": {
          "total": {
            "type": "number"
          },
          "page": {
            "type": "number"
          },
          "limit": {
            "type": "number"
          },
          "total_pages": {
            "type": "number"
          },
          "has_next_page": {
            "type": "boolean"
          },
          "has_prev_page": {
            "type": "boolean"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CrawlPage"
            }
          }
        },
        "required": [
          "total",
          "page",
          "limit",
          "total_pages",
          "has_next_page",
          "has_prev_page",
          "data"
        ],
        "additionalProperties": false
      },
      "PublicKnowledgebaseItem": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/PublicKnowledgebaseItem",
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "visibility": {
            "type": "string",
            "enum": [
              "internal",
              "public"
            ]
          },
          "source_type": {
            "type": "string",
            "enum": [
              "custom_training",
              "help_center",
              "integration",
              "website",
              "workflow"
            ]
          },
          "data_source": {
            "description": "External source the item was synced from (present when listing).",
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "confluence",
                  "notion",
                  "zendesk_support",
                  "shopify",
                  "gitbook",
                  "intercom",
                  "front",
                  "freshdesk",
                  "hubspot_kb",
                  "ai_instructions",
                  "custom_training",
                  "website",
                  "workflow",
                  "help_center"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "stream": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "source_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "restricted_to_segments": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Contact segment ids this item is restricted to. Empty = available to all contacts."
          },
          "restricted_to_channels": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SessionChannel"
            },
            "description": "Channels this item is restricted to. Empty = available on all channels."
          },
          "start_time": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "Active window start (UTC). Null = no start bound."
          },
          "end_time": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "Active window end (UTC). Null = no end bound."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "title",
          "visibility",
          "source_type",
          "source_url",
          "restricted_to_segments",
          "restricted_to_channels",
          "start_time",
          "end_time",
          "updated_at"
        ],
        "additionalProperties": false
      },
      "ListPublicKnowledgebaseItemsOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ListPublicKnowledgebaseItemsOutput",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicKnowledgebaseItem"
            }
          },
          "pagination": {
            "type": "object",
            "properties": {
              "current_page": {
                "type": "number"
              },
              "total_pages": {
                "type": "number"
              },
              "total_items": {
                "type": "number"
              },
              "items_per_page": {
                "type": "number"
              },
              "has_next_page": {
                "type": "boolean"
              },
              "has_previous_page": {
                "type": "boolean"
              }
            },
            "required": [
              "current_page",
              "total_pages",
              "total_items",
              "items_per_page",
              "has_next_page",
              "has_previous_page"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "items",
          "pagination"
        ],
        "additionalProperties": false
      },
      "CsatScoreAgent": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CsatScoreAgent",
        "type": "object",
        "properties": {
          "id": {
            "type": "number"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "avatar_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "name",
          "avatar_url"
        ],
        "additionalProperties": false
      },
      "CsatScoreTeam": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CsatScoreTeam",
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "name"
        ],
        "additionalProperties": false
      },
      "CsatScorePublic": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CsatScorePublic",
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "organization_id": {
            "type": "string"
          },
          "session_id": {
            "type": "string"
          },
          "score": {
            "type": "number"
          },
          "comment": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "channel": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "contact": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Contact"
              },
              {
                "type": "null"
              }
            ]
          },
          "agent": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CsatScoreAgent"
              },
              {
                "type": "null"
              }
            ],
            "description": "The agent this score is attributed to: the session assignee at the moment the customer submitted it. Fixed at submit time, so reassigning the session afterwards never moves the rating. Null when the session was unassigned."
          },
          "team": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CsatScoreTeam"
              },
              {
                "type": "null"
              }
            ],
            "description": "The team this score is attributed to, captured at the moment the customer submitted it. Fixed at submit time, so moving the session between teams afterwards never moves the rating. Null when the session belonged to no team."
          }
        },
        "required": [
          "id",
          "organization_id",
          "session_id",
          "score",
          "comment",
          "channel",
          "created_at",
          "updated_at",
          "contact",
          "agent",
          "team"
        ],
        "additionalProperties": false
      },
      "CsatScorePublicResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CsatScorePublicResponseDto",
        "anyOf": [
          {
            "$ref": "#/components/schemas/CsatScorePublic"
          },
          {
            "type": "null"
          }
        ]
      },
      "PaginatedCsatScoresPublicResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/PaginatedCsatScoresPublicResponseDto",
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CsatScorePublic"
            }
          },
          "current_page": {
            "type": "number"
          },
          "per_page": {
            "type": "number"
          },
          "total": {
            "type": "number"
          },
          "total_pages": {
            "type": "number"
          }
        },
        "required": [
          "data",
          "current_page",
          "per_page",
          "total",
          "total_pages"
        ],
        "additionalProperties": false
      },
      "StructuredFieldsPublicMessageDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/StructuredFieldsPublicMessageDto",
        "type": "object",
        "properties": {
          "message": {
            "type": "string"
          }
        },
        "required": [
          "message"
        ],
        "additionalProperties": false
      },
      "AutopilotStatusResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/AutopilotStatusResponseDto",
        "type": "object",
        "properties": {
          "channels": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "channel": {
                  "type": "string",
                  "description": "Channel name"
                },
                "autopilot_enabled": {
                  "type": "boolean",
                  "description": "Whether the AI autopilot is enabled on this channel"
                },
                "ai_agent_version": {
                  "type": "string",
                  "enum": [
                    "v1",
                    "v2"
                  ],
                  "description": "AI agent version used on this channel"
                }
              },
              "required": [
                "channel",
                "autopilot_enabled",
                "ai_agent_version"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "channels"
        ],
        "additionalProperties": false
      },
      "ProhibitedTopicsResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ProhibitedTopicsResponseDto",
        "type": "object",
        "properties": {
          "topics": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Topic names only. When a session matches any of these, the AI hands off to a human (subject to per-channel handoff behavior)."
          },
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "description": "The topic name."
                },
                "description": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Guidance the AI uses when deciding whether a session matches this topic, or null. Conditions stated here are applied as strict rules."
                }
              },
              "required": [
                "name",
                "description"
              ],
              "additionalProperties": false
            },
            "description": "The same topics, each with its description."
          }
        },
        "required": [
          "topics",
          "items"
        ],
        "additionalProperties": false
      },
      "OutboundBlocklistEntryDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/OutboundBlocklistEntryDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "identity_type": {
            "type": "string",
            "description": "\"phone\", \"email\" or \"whatsapp_user_id\"."
          },
          "identity_value": {
            "type": "string",
            "description": "The address, as we stored it after normalizing."
          },
          "channel": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The channel this entry covers. Null means every channel — that is what entries added through this API always are. A specific channel appears when someone opted out of that channel alone."
          },
          "reason": {
            "type": "string",
            "description": "Why the address was blocked."
          },
          "source": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Where the entry came from. \"api\" is one you added. \"agent_correction\" is one a teammate added by marking a sequence call as a wrong number. Anything else was recorded when the person opted out themselves. Only \"api\" entries are removable by default."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "When the block lifts automatically. Null means it never does."
          }
        },
        "required": [
          "id",
          "identity_type",
          "identity_value",
          "channel",
          "reason",
          "source",
          "created_at",
          "expires_at"
        ],
        "additionalProperties": false
      },
      "PublicEmailChannelDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/PublicEmailChannelDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "connection_status": {
            "type": "string",
            "enum": [
              "connected",
              "failed",
              "pending"
            ]
          },
          "is_default": {
            "type": "boolean"
          },
          "sender_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "html_template": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "sender_signature": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "email",
          "connection_status",
          "is_default",
          "sender_name",
          "html_template",
          "sender_signature"
        ],
        "additionalProperties": false
      },
      "PutCustomDomainOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/PutCustomDomainOutput",
        "type": "object",
        "properties": {
          "domainRecords": {
            "anyOf": [
              {},
              {
                "type": "null"
              }
            ]
          },
          "domainStatus": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "domainRecords",
          "domainStatus"
        ],
        "additionalProperties": false
      },
      "MacroSettingsDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/MacroSettingsDto",
        "type": "object",
        "properties": {
          "translation_languages": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Language codes (lower-case, such as `es`) every org-wide macro is translated into, in the order they were chosen. Empty means macro translation is off."
          },
          "max_translation_languages": {
            "type": "number",
            "description": "The most languages that can be chosen."
          },
          "supported_translation_languages": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The language codes that can be chosen."
          },
          "suggestions_enabled": {
            "type": "boolean",
            "description": "Whether suggested macros are on for the workspace. When off, no agent sees them."
          }
        },
        "required": [
          "translation_languages",
          "max_translation_languages",
          "supported_translation_languages",
          "suggestions_enabled"
        ],
        "additionalProperties": false
      },
      "HandoffAnalyticsPublicResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/HandoffAnalyticsPublicResponseDto",
        "type": "object",
        "properties": {
          "summary": {
            "type": "string"
          },
          "total_handoffs": {
            "type": "number"
          },
          "total_sessions": {
            "type": "number"
          },
          "start_date": {
            "type": "string"
          },
          "end_date": {
            "type": "string"
          },
          "reasons": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "reason": {
                  "type": "string",
                  "enum": [
                    "ai_implied_handoff",
                    "based_on_instructions",
                    "feature_limit_reached__ai_resolutions",
                    "feature_limit_reached__ai_voice_minutes",
                    "instructions_not_clear",
                    "insufficient_knowledge",
                    "insufficient_tools",
                    "prohibited_topic",
                    "user_requested_human_assistance"
                  ]
                },
                "count": {
                  "type": "number"
                },
                "percentage": {
                  "type": "number"
                }
              },
              "required": [
                "reason",
                "count",
                "percentage"
              ],
              "additionalProperties": false
            }
          },
          "reason_combinations": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "reasons": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "enum": [
                      "ai_implied_handoff",
                      "based_on_instructions",
                      "feature_limit_reached__ai_resolutions",
                      "feature_limit_reached__ai_voice_minutes",
                      "instructions_not_clear",
                      "insufficient_knowledge",
                      "insufficient_tools",
                      "prohibited_topic",
                      "user_requested_human_assistance"
                    ]
                  }
                },
                "session_count": {
                  "type": "number"
                },
                "percentage": {
                  "type": "number"
                }
              },
              "required": [
                "reasons",
                "session_count",
                "percentage"
              ],
              "additionalProperties": false
            }
          },
          "sentiments": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "sentiment": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "count": {
                  "type": "number"
                },
                "percentage": {
                  "type": "number"
                }
              },
              "required": [
                "sentiment",
                "count",
                "percentage"
              ],
              "additionalProperties": false
            }
          },
          "trends": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "date": {
                  "type": "string"
                },
                "count": {
                  "type": "number"
                }
              },
              "required": [
                "date",
                "count"
              ],
              "additionalProperties": false
            }
          },
          "knowledge_references": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "ai_profile",
                    "instruction",
                    "knowledge",
                    "prohibited_topic",
                    "tool"
                  ]
                },
                "id": {
                  "type": "string"
                },
                "count": {
                  "type": "number"
                }
              },
              "required": [
                "type",
                "id",
                "count"
              ],
              "additionalProperties": false
            }
          },
          "tool_references": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "ai_profile",
                    "instruction",
                    "knowledge",
                    "prohibited_topic",
                    "tool"
                  ]
                },
                "id": {
                  "type": "string"
                },
                "count": {
                  "type": "number"
                }
              },
              "required": [
                "type",
                "id",
                "count"
              ],
              "additionalProperties": false
            }
          },
          "instruction_references": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "ai_profile",
                    "instruction",
                    "knowledge",
                    "prohibited_topic",
                    "tool"
                  ]
                },
                "id": {
                  "type": "string"
                },
                "count": {
                  "type": "number"
                }
              },
              "required": [
                "type",
                "id",
                "count"
              ],
              "additionalProperties": false
            }
          },
          "prohibited_topic_references": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "ai_profile",
                    "instruction",
                    "knowledge",
                    "prohibited_topic",
                    "tool"
                  ]
                },
                "id": {
                  "type": "string"
                },
                "count": {
                  "type": "number"
                }
              },
              "required": [
                "type",
                "id",
                "count"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "summary",
          "total_handoffs",
          "total_sessions",
          "start_date",
          "end_date",
          "reasons",
          "reason_combinations",
          "sentiments",
          "trends",
          "knowledge_references",
          "tool_references",
          "instruction_references",
          "prohibited_topic_references"
        ],
        "additionalProperties": false
      },
      "ImpactReportResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ImpactReportResponseDto",
        "type": "object",
        "properties": {
          "start_date": {
            "type": "string"
          },
          "end_date": {
            "type": "string"
          },
          "total_resolved": {
            "type": "number"
          },
          "total_assumed_resolved": {
            "type": "number"
          },
          "total_handed_off": {
            "type": "number"
          },
          "total_in_progress": {
            "type": "number"
          },
          "automation_rate": {
            "type": "number"
          },
          "resolutions_daily": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "day": {
                  "type": "string"
                },
                "resolved": {
                  "type": "number"
                },
                "assumed_resolved": {
                  "type": "number"
                },
                "handed_off": {
                  "type": "number"
                },
                "in_progress": {
                  "type": "number"
                }
              },
              "required": [
                "day",
                "resolved",
                "assumed_resolved",
                "handed_off",
                "in_progress"
              ],
              "additionalProperties": false
            }
          },
          "automation_rate_daily": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "day": {
                  "type": "string"
                },
                "automation_rate": {
                  "type": "number"
                }
              },
              "required": [
                "day",
                "automation_rate"
              ],
              "additionalProperties": false
            }
          },
          "sentiments_daily": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "day": {
                  "type": "string"
                },
                "happy": {
                  "type": "number"
                },
                "neutral": {
                  "type": "number"
                },
                "angry": {
                  "type": "number"
                },
                "in_progress": {
                  "type": "number"
                }
              },
              "required": [
                "day",
                "happy",
                "neutral",
                "angry",
                "in_progress"
              ],
              "additionalProperties": false
            }
          },
          "resolution_totals": {
            "type": "object",
            "properties": {
              "resolved": {
                "type": "number"
              },
              "assumed_resolved": {
                "type": "number"
              },
              "handed_off": {
                "type": "number"
              },
              "in_progress": {
                "type": "number"
              }
            },
            "required": [
              "resolved",
              "assumed_resolved",
              "handed_off",
              "in_progress"
            ],
            "additionalProperties": false
          },
          "sentiment_totals": {
            "type": "object",
            "properties": {
              "happy": {
                "type": "number"
              },
              "neutral": {
                "type": "number"
              },
              "angry": {
                "type": "number"
              },
              "in_progress": {
                "type": "number"
              }
            },
            "required": [
              "happy",
              "neutral",
              "angry",
              "in_progress"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "start_date",
          "end_date",
          "total_resolved",
          "total_assumed_resolved",
          "total_handed_off",
          "total_in_progress",
          "automation_rate",
          "resolutions_daily",
          "automation_rate_daily",
          "sentiments_daily",
          "resolution_totals",
          "sentiment_totals"
        ],
        "additionalProperties": false
      },
      "OfficeHoursPublicResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/OfficeHoursPublicResponseDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Office hours schedule ID"
          },
          "name": {
            "type": "string",
            "description": "Schedule name (e.g. \"Weekday Support\", \"Weekend Hours\")"
          },
          "iana_timezone": {
            "type": "string",
            "description": "IANA timezone (e.g. \"America/New_York\", \"Europe/London\")"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "exceptions": {
            "maxItems": 200,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OfficeHoursExceptionDto"
            }
          },
          "shifts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "day_of_week": {
                  "type": "string",
                  "enum": [
                    "everyday",
                    "friday",
                    "friday_and_saturday",
                    "monday",
                    "monday_to_friday",
                    "saturday",
                    "sunday",
                    "sunday_and_monday",
                    "sunday_to_thursday",
                    "thursday",
                    "tuesday",
                    "wednesday"
                  ],
                  "description": "Day(s) of week: \"monday\", \"tuesday\", \"wednesday\", \"thursday\", \"friday\", \"saturday\", \"sunday\", \"everyday\", \"monday_to_friday\", \"sunday_to_thursday\", \"friday_and_saturday\", \"sunday_and_monday\""
                },
                "start_time": {
                  "type": "string",
                  "description": "Start time in HH:mm:ss format (e.g. \"09:00:00\")"
                },
                "end_time": {
                  "type": "string",
                  "description": "End time in HH:mm:ss format (e.g. \"17:00:00\")"
                },
                "id": {
                  "type": "string",
                  "description": "Shift ID"
                },
                "created_at": {
                  "type": "string",
                  "format": "date-time"
                },
                "updated_at": {
                  "type": "string",
                  "format": "date-time"
                }
              },
              "required": [
                "day_of_week",
                "start_time",
                "end_time",
                "id",
                "created_at",
                "updated_at"
              ],
              "additionalProperties": false
            },
            "description": "The time blocks when support is available"
          }
        },
        "required": [
          "id",
          "name",
          "iana_timezone",
          "created_at",
          "updated_at",
          "exceptions",
          "shifts"
        ],
        "additionalProperties": false
      },
      "TagPublicResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/TagPublicResponseDto",
        "type": "object",
        "properties": {
          "tag_name": {
            "type": "string",
            "description": "The tag name (unique per org)"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional description of what this tag means"
          },
          "exclude_from_auto_tagging": {
            "type": "boolean",
            "description": "If true, the AI will never auto-apply this tag"
          },
          "category_id": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              {
                "type": "null"
              }
            ],
            "description": "Category this tag belongs to, or null if uncategorized"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "tag_name",
          "description",
          "exclude_from_auto_tagging",
          "category_id",
          "created_at",
          "updated_at"
        ],
        "additionalProperties": false
      },
      "TagCategoryPublicResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/TagCategoryPublicResponseDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
            "description": "The category id"
          },
          "org_id": {
            "type": "string",
            "description": "The organization this category belongs to"
          },
          "name": {
            "type": "string",
            "description": "The category name (unique per org)"
          },
          "description": {
            "type": "string",
            "description": "What this category groups together"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "org_id",
          "name",
          "description",
          "created_at",
          "updated_at"
        ],
        "additionalProperties": false
      },
      "InboxViewDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/InboxViewDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "name": {
            "type": "string",
            "description": "Name shown in the inbox view picker"
          },
          "filters": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "date": {
                    "description": "Date range filter on session creation time",
                    "type": "object",
                    "properties": {
                      "from": {
                        "description": "Start date (ISO 8601)",
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                      },
                      "to": {
                        "description": "End date (ISO 8601)",
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                      },
                      "preset": {
                        "description": "Rolling window resolved every time the view is opened: \"today\", \"last_3_days\" or \"last_7_days\". Mutually exclusive with from/to.",
                        "type": "string",
                        "enum": [
                          "today",
                          "last_3_days",
                          "last_7_days"
                        ]
                      }
                    },
                    "additionalProperties": false
                  },
                  "channels": {
                    "description": "Filter by channels (web, email, whatsapp, phone_voice, sms, slack, etc.)",
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/SessionChannel"
                    }
                  },
                  "status": {
                    "description": "Filter by built-in status codes (0 = open, 1 = closed_resolved, 2 = closed_unresolved)",
                    "type": "array",
                    "items": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 2147483647
                    }
                  },
                  "sub_status_ids": {
                    "description": "Filter by custom status ids (sessions whose `sub_status_id` is any of these). Ids come from GET /custom-statuses. An empty array applies no filter, like the other array filters here.",
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                    }
                  },
                  "ai_closure": {
                    "description": "Filter by AI closure type (e.g. \"handed_off\", \"resolved\", \"no_resolution\")",
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "assumed_resolved",
                        "handed_off",
                        "resolved"
                      ]
                    }
                  },
                  "sentiment": {
                    "description": "Filter by customer sentiment (angry, happy, neutral)",
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "angry",
                        "happy",
                        "neutral"
                      ]
                    }
                  },
                  "assignees": {
                    "description": "Filter by assignee user IDs (empty array = unassigned). The \"$current_user\" token resolves to whoever opens the view, so one shared view can mean \"assigned to me\" for every teammate.",
                    "type": "array",
                    "items": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 2147483647
                        },
                        {
                          "type": "string",
                          "const": "$current_user"
                        }
                      ]
                    }
                  },
                  "team_ids": {
                    "description": "Filter by assigned team/group IDs. For the inbox Support Team filter, use support_team_ids. Use the \"$unassigned\" token to match sessions with no team.",
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "support_team_ids": {
                    "description": "Filter by Support Team IDs (from GET /teams): the support team whose inbox contains the session. Distinct from team_ids and view-sharing permissions. Use the \"$unassigned\" token to match sessions with no support team.",
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "contact_ids": {
                    "description": "Filter by contact IDs",
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "ticket_number": {
                    "description": "Filter by exact ticket number",
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 2147483647
                  },
                  "language": {
                    "description": "Filter by session language codes",
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "tags": {
                    "description": "Filter by tag names (sessions must have ALL specified tags)",
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "waiting_on": {
                    "description": "Filter by who the session is waiting on",
                    "type": "string",
                    "enum": [
                      "customers",
                      "human_agents"
                    ]
                  },
                  "custom_data": {
                    "description": "Filter by session custom data (OR between objects, AND within each object)",
                    "type": "array",
                    "items": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "string"
                      }
                    }
                  }
                },
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ],
            "description": "The saved filter set. `null` when `advanced` is true — the view uses filters this API cannot express."
          },
          "advanced": {
            "type": "boolean",
            "description": "True when the view was built in the dashboard with OR/exclude groups or filters outside this API's vocabulary. Its `filters` read back as null, and updating `filters` on it REPLACES the whole saved query with the simple set you send."
          },
          "sort_by": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "last_message_at",
                  "created_at",
                  "sla_urgency",
                  "snoozed_until"
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "Sort field the view opens with"
          },
          "sort_order": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "asc",
                  "desc"
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "Sort direction the view opens with"
          },
          "group_by": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "tags",
                  "contact_attribute",
                  "session_attribute",
                  "channel",
                  "assignee_id",
                  "status",
                  "sub_status_id",
                  "ai_closure_type",
                  "language",
                  "inbox_id"
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "Field sessions are grouped by in the list, when the view groups them"
          },
          "group_by_attribute": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Exact attribute key for contact or session attribute grouping, or null when no key is set."
          },
          "shared_with_user_ids": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            "description": "User ids the view is shared with. Empty (with no teams) means the whole org."
          },
          "shared_with_team_ids": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Team ids the view is shared with. Empty (with no users) means the whole org."
          },
          "visibility": {
            "type": "string",
            "enum": [
              "organization",
              "personal",
              "restricted"
            ]
          },
          "created_by_user_id": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "can_edit": {
            "type": "boolean",
            "description": "Whether the calling user may update this view"
          },
          "can_delete": {
            "type": "boolean",
            "description": "Whether the calling user may delete this view"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "name",
          "filters",
          "advanced",
          "sort_by",
          "sort_order",
          "group_by",
          "group_by_attribute",
          "shared_with_user_ids",
          "shared_with_team_ids",
          "visibility",
          "created_by_user_id",
          "can_edit",
          "can_delete",
          "created_at",
          "updated_at"
        ],
        "additionalProperties": false
      },
      "WorkflowPublicResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/WorkflowPublicResponseDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "number",
            "description": "Version serial ID"
          },
          "workflow_id": {
            "type": "string",
            "description": "Workflow UUID (groups all versions of the same workflow)"
          },
          "name": {
            "type": "string",
            "description": "Workflow name"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Workflow description"
          },
          "is_active": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "description": "Whether this version is currently active"
          },
          "trigger_type": {
            "type": "string",
            "description": "Trigger type: \"manual-trigger\", \"ai-trigger\", \"cron-trigger\", \"webhook\", \"form-trigger\", or event-based triggers"
          },
          "version_number": {
            "type": "number",
            "description": "Version number (increments with each edit)"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "workflow_id",
          "name",
          "description",
          "is_active",
          "trigger_type",
          "version_number",
          "created_at",
          "updated_at"
        ],
        "additionalProperties": false
      },
      "WorkflowDetailPublicResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/WorkflowDetailPublicResponseDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "number",
            "description": "Version serial ID"
          },
          "workflow_id": {
            "type": "string",
            "description": "Workflow UUID (groups all versions of the same workflow)"
          },
          "name": {
            "type": "string",
            "description": "Workflow name"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Workflow description"
          },
          "is_active": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "description": "Whether this version is currently active"
          },
          "trigger_type": {
            "type": "string",
            "description": "Trigger type: \"manual-trigger\", \"ai-trigger\", \"cron-trigger\", \"webhook\", \"form-trigger\", or event-based triggers"
          },
          "version_number": {
            "type": "number",
            "description": "Version number (increments with each edit)"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "workflow_blocks": {
            "anyOf": [
              {
                "type": "array",
                "items": {}
              },
              {
                "type": "null"
              }
            ],
            "description": "Workflow step/block definitions"
          },
          "trigger_configuration": {
            "anyOf": [
              {},
              {
                "type": "null"
              }
            ],
            "description": "Trigger-specific configuration"
          },
          "webhook_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Trigger URL for webhook-type workflows. Call this URL (POST) to trigger the workflow. Null for non-webhook workflows."
          }
        },
        "required": [
          "id",
          "workflow_id",
          "name",
          "description",
          "is_active",
          "trigger_type",
          "version_number",
          "created_at",
          "updated_at",
          "workflow_blocks",
          "trigger_configuration",
          "webhook_url"
        ],
        "additionalProperties": false
      },
      "WorkflowRunPublicResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/WorkflowRunPublicResponseDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Run UUID"
          },
          "workflow_id": {
            "type": "number",
            "description": "Workflow version serial ID that was executed"
          },
          "status": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "canceled",
                  "completed",
                  "failed",
                  "idle",
                  "in_progress",
                  "waiting"
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "Run status: \"idle\", \"in_progress\", \"completed\", \"failed\", \"canceled\""
          },
          "trigger_cause": {
            "type": "string",
            "enum": [
              "automatic",
              "manual",
              "scheduled"
            ],
            "description": "What caused the run: \"manual\", \"automatic\", \"scheduled\""
          },
          "duration_in_seconds": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "How long the run took"
          },
          "run_started_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "run_ended_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "is_test_run": {
            "type": "boolean",
            "description": "Whether this was a test run"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "workflow_id",
          "status",
          "trigger_cause",
          "duration_in_seconds",
          "run_started_at",
          "run_ended_at",
          "is_test_run",
          "created_at"
        ],
        "additionalProperties": false
      },
      "ValidateWorkflowPublicOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ValidateWorkflowPublicOutput",
        "type": "object",
        "properties": {
          "valid": {
            "type": "boolean",
            "description": "Whether the workflow definition is valid (no error-severity issues)"
          },
          "issues": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "step_id": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "The step ID where the issue was found, if applicable"
                },
                "message": {
                  "type": "string",
                  "description": "Description of the validation issue"
                },
                "severity": {
                  "type": "string",
                  "enum": [
                    "error",
                    "warning"
                  ],
                  "description": "\"error\" blocks create/update/activate; \"warning\" is advisory only"
                }
              },
              "required": [
                "step_id",
                "message",
                "severity"
              ],
              "additionalProperties": false
            },
            "description": "List of validation issues found"
          },
          "action_types_used": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "List of action types referenced in the workflow"
          }
        },
        "required": [
          "valid",
          "issues",
          "action_types_used"
        ],
        "additionalProperties": false
      },
      "WorkflowValidationErrorResponse": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/WorkflowValidationErrorResponse",
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "const": 400
          },
          "message": {
            "type": "string",
            "description": "Human-readable summary of the validation failure"
          },
          "error": {
            "type": "string"
          },
          "issues": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "step_id": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "The step ID where the issue was found, if applicable"
                },
                "message": {
                  "type": "string",
                  "description": "Description of the validation issue"
                },
                "severity": {
                  "type": "string",
                  "enum": [
                    "error",
                    "warning"
                  ],
                  "description": "\"error\" blocks create/update/activate; \"warning\" is advisory only"
                }
              },
              "required": [
                "step_id",
                "message",
                "severity"
              ],
              "additionalProperties": false
            },
            "description": "Structured validation issues — fix each step_id and retry"
          }
        },
        "required": [
          "statusCode",
          "message",
          "error",
          "issues"
        ],
        "additionalProperties": false
      },
      "FieldSchemaPublicDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/FieldSchemaPublicDto",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Field name (use as key in input object)"
          },
          "type": {
            "type": "string",
            "description": "Field type: text, number, boolean, select, object, array, etc."
          },
          "display_name": {
            "type": "string",
            "description": "Human-readable label"
          },
          "description": {
            "description": "What this field does",
            "type": "string"
          },
          "required": {
            "type": "boolean",
            "description": "Whether this field must be provided"
          }
        },
        "required": [
          "name",
          "type",
          "display_name",
          "required"
        ],
        "additionalProperties": false
      },
      "ActionTypePublicDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ActionTypePublicDto",
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Action type identifier (e.g. \"ask-ai\", \"send-webhook\"). Use this as the \"type\" in workflow_blocks."
          },
          "name": {
            "type": "string",
            "description": "Human-readable name"
          },
          "description": {
            "type": "string",
            "description": "What this action does"
          },
          "category": {
            "type": "string",
            "description": "Action category (e.g. \"AI\", \"Session\", \"Outbound\")"
          },
          "icon": {
            "type": "string",
            "description": "Icon name"
          },
          "input_fields": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/FieldSchemaPublicDto"
                }
              },
              {
                "type": "null"
              }
            ],
            "description": "Input fields this action accepts. Pass these in the \"input\" object of the workflow block."
          },
          "output_fields": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/FieldSchemaPublicDto"
                }
              },
              {
                "type": "null"
              }
            ],
            "description": "Output fields this action produces. Reference via {{step_id.field_name}}."
          },
          "input_shape": {
            "anyOf": [
              {},
              {
                "type": "null"
              }
            ],
            "description": "Raw nested input schema for actions whose inputs include `Field.Object` or `Field.JsonSchema` properties (e.g. ask-ai's resultShape, make-http-call's responseSchema). When set, this is the source of truth — input_fields is a flattened summary."
          },
          "output_shape": {
            "anyOf": [
              {},
              {
                "type": "null"
              }
            ],
            "description": "Raw nested output schema, same shape as input_shape for outputs."
          },
          "supported_trigger_types": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              {
                "type": "null"
              }
            ],
            "description": "Trigger types this action is compatible with. Filter actions by this when composing a workflow for a specific trigger. Null means compatible with any trigger."
          },
          "can_test": {
            "type": "boolean",
            "description": "Whether this action supports being tested in isolation via the dashboard test runner."
          }
        },
        "required": [
          "type",
          "name",
          "description",
          "category",
          "icon",
          "input_fields",
          "output_fields",
          "input_shape",
          "output_shape",
          "supported_trigger_types",
          "can_test"
        ],
        "additionalProperties": false
      },
      "TriggerTypePublicDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/TriggerTypePublicDto",
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Trigger type identifier. Use this as the \"trigger_type\" when creating a workflow."
          },
          "name": {
            "type": "string",
            "description": "Human-readable name"
          },
          "description": {
            "type": "string",
            "description": "What this trigger does"
          },
          "icon": {
            "type": "string",
            "description": "Icon name"
          },
          "payload_def": {
            "anyOf": [
              {},
              {
                "type": "null"
              }
            ],
            "description": "Field schema for the trigger payload (the event shape the runtime receives). For triggers whose payload is defined per-workflow (`ai-trigger`, `form-trigger`, `manual-ticket-trigger`), this is empty — the real per-workflow payload contract lives in configuration_def's `Field.JsonSchema`-typed property (aiPayloadShape / formSchema) that the workflow author sets via trigger_configuration."
          },
          "configuration_def": {
            "anyOf": [
              {},
              {
                "type": "null"
              }
            ],
            "description": "Field schema for the trigger configuration. When non-empty, the workflow author MUST set every required property in trigger_configuration. Examples: ai-trigger needs theGoalOfTheWorkflow + aiPayloadShape; cron-trigger needs cronExpression; webhook needs accessControl."
          }
        },
        "required": [
          "type",
          "name",
          "description",
          "icon",
          "payload_def",
          "configuration_def"
        ],
        "additionalProperties": false
      },
      "OperatorPublicDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/OperatorPublicDto",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Operator identifier — use this exact value as \"operatorName\" in conditions (e.g. \"equals\", \"notEquals\", \"stringContains\")."
          },
          "display_name": {
            "type": "string",
            "description": "Human-readable name"
          },
          "type": {
            "type": "string",
            "enum": [
              "Unary",
              "Binary",
              "Logical"
            ],
            "description": "Operator arity. \"Unary\": condition takes \"left\" only. \"Binary\": condition takes \"left\" and \"right\". \"Logical\": \"and\"/\"or\" take a \"conditions\" array of nested conditions; \"not\" takes a single \"condition\"."
          },
          "applies_to": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "String",
                "Number",
                "Boolean",
                "Array",
                "Object",
                "DateTime",
                "LongText",
                "Url",
                "Email",
                "Select",
                "LazySelect",
                "Code",
                "MultiSelect",
                "LazyMultiSelect",
                "JsonSchema",
                "Any",
                "AnyObject",
                "RichText",
                "File",
                "PhoneNumber",
                "DateOnly",
                "CronExpression",
                "Integer"
              ]
            },
            "description": "Field types this operator can be applied to"
          }
        },
        "required": [
          "name",
          "display_name",
          "type",
          "applies_to"
        ],
        "additionalProperties": false
      },
      "WorkflowDefinitionsPublicDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/WorkflowDefinitionsPublicDto",
        "type": "object",
        "properties": {
          "action_types": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ActionTypePublicDto"
            },
            "description": "Available action types with their input/output schemas"
          },
          "trigger_types": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TriggerTypePublicDto"
            },
            "description": "Available trigger types"
          },
          "block_types": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                }
              },
              "required": [
                "type",
                "name",
                "description"
              ],
              "additionalProperties": false
            },
            "description": "Available control-flow block types"
          },
          "operators": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OperatorPublicDto"
            },
            "description": "Condition operators for if-else blocks, from the engine registry. This is the complete set the runtime evaluates — always pick \"operatorName\" from this list."
          },
          "extra_variables": {
            "type": "array",
            "items": {},
            "description": "Field schemas for the extra reference scopes available in every run, beyond the trigger payload and step outputs. Each entry's \"name\" is the scope root and its \"properties\" are the referenceable fields: {{metadata.<field>}} (date/time of the run), {{run.<field>}}, {{workflow.<field>}}, {{organization.<field>}}, and {{variables.<key>}} for the organization's global variables. Leaf scopes have no \"properties\" and are referenced directly, e.g. {{routingSkills}} — a JSON string of every org skill (name + description)."
          }
        },
        "required": [
          "action_types",
          "trigger_types",
          "block_types",
          "operators",
          "extra_variables"
        ],
        "additionalProperties": false
      },
      "TestWorkflowPublicOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/TestWorkflowPublicOutput",
        "type": "object",
        "properties": {
          "run_id": {
            "type": "string",
            "description": "UUID of the test run — feed into /workflows/:workflow_id/runs/:run_id"
          }
        },
        "required": [
          "run_id"
        ],
        "additionalProperties": false
      },
      "RerunWorkflowRunPublicOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/RerunWorkflowRunPublicOutput",
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "new_run_id": {
            "description": "UUID of the new run when the rerun was kicked off (even if it then failed)",
            "type": "string"
          },
          "error": {
            "description": "Failure reason when success is false",
            "type": "string"
          }
        },
        "required": [
          "success"
        ],
        "additionalProperties": false
      },
      "OrganizationDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/OrganizationDto",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "The name of the organization."
          },
          "created_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "When the organization was created."
          },
          "updated_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "When the organization was last updated."
          }
        },
        "required": [
          "name",
          "created_at",
          "updated_at"
        ],
        "additionalProperties": false
      },
      "SessionSidebarDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SessionSidebarDto",
        "type": "object",
        "properties": {
          "card_order": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Cards and widgets in the order the session sidebar shows them: built-in card keys and `app:<mini app id>` entries, one per mini-app widget. Empty means the default arrangement."
          },
          "hidden_cards": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Built-in card keys hidden from the sidebar."
          }
        },
        "required": [
          "card_order",
          "hidden_cards"
        ],
        "additionalProperties": false
      },
      "WebCallSuccessDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/WebCallSuccessDto",
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          }
        },
        "required": [
          "success"
        ],
        "additionalProperties": false
      },
      "HandBackCallOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/HandBackCallOutput",
        "type": "object",
        "properties": {
          "session_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "status": {
            "type": "string",
            "const": "handed_back"
          }
        },
        "required": [
          "session_id",
          "status"
        ],
        "additionalProperties": false
      },
      "SetPhoneAgentCallerNumberOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SetPhoneAgentCallerNumberOutput",
        "type": "object",
        "properties": {
          "phone_agent_id": {
            "type": "string"
          },
          "caller_number": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "phone_agent_id",
          "caller_number"
        ],
        "additionalProperties": false
      },
      "PhoneAgentDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/PhoneAgentDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "org_id": {
            "type": "string"
          },
          "phone_number": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "outbound_caller_number": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "inbound",
              "outbound"
            ]
          },
          "language": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "accent": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "handoff_phone_number": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "speed": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "interruptible": {
            "type": "boolean"
          },
          "actionIds": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "instructions": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "data_collection_fields": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "data_collection_webhook_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "model": {
            "type": "string",
            "enum": [
              "oppie-vox",
              "oppie-vox-turbo",
              "oppie-vox-livekit"
            ]
          },
          "voice_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "voice_mode": {
            "type": "string",
            "enum": [
              "modular",
              "live"
            ]
          },
          "first_message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "provider_external_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "flow": {
            "anyOf": [
              {},
              {
                "type": "null"
              }
            ]
          },
          "use_org_knowledgebase": {
            "type": "boolean"
          },
          "background_noise_preset": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "office",
                  "bar",
                  "city-street"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "recording_enabled": {
            "type": "boolean"
          },
          "search_enabled": {
            "type": "boolean",
            "description": "Whether the agent searches its selected knowledge during calls. Set on save: on only when the selection is too large to load at the start of each call."
          },
          "stt_keyterms": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "stt_model": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "deepgram/flux-general",
                  "deepgram/nova-3",
                  "deepgram/nova-3-medical",
                  "cartesia/ink-whisper",
                  "elevenlabs/scribe_v2_realtime",
                  "xai/stt-1",
                  "assemblyai/universal-3-5-pro",
                  "speechmatics/enhanced",
                  "google/gemini-3.5-transcribe-live",
                  "soniox/stt-rt-v5",
                  "openai/gpt-live-transcribe"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "tts_speed_pct": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "tts_provider": {
            "type": "string",
            "enum": [
              "elevenlabs",
              "cartesia"
            ]
          },
          "failover_transfer_destination_id": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              {
                "type": "null"
              }
            ]
          },
          "transfer_destination_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "description": "Transfer destinations the agent may transfer to (`transfer_call` targets)."
          }
        },
        "required": [
          "id",
          "org_id",
          "phone_number",
          "outbound_caller_number",
          "name",
          "type",
          "language",
          "accent",
          "handoff_phone_number",
          "speed",
          "interruptible",
          "actionIds",
          "instructions",
          "data_collection_fields",
          "data_collection_webhook_url",
          "model",
          "voice_id",
          "voice_mode",
          "first_message",
          "created_at",
          "updated_at",
          "provider_external_id",
          "flow",
          "use_org_knowledgebase",
          "background_noise_preset",
          "recording_enabled",
          "search_enabled",
          "stt_keyterms",
          "stt_model",
          "tts_speed_pct",
          "tts_provider",
          "failover_transfer_destination_id",
          "transfer_destination_ids"
        ],
        "additionalProperties": false
      },
      "PublicResourceUsageConversationsDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/PublicResourceUsageConversationsDto",
        "type": "object",
        "properties": {
          "conversations": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "session_id": {
                  "type": "string"
                },
                "ticket_number": {
                  "anyOf": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Inbox ticket number, if assigned"
                },
                "last_message": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "The conversation’s most recent message"
                },
                "reply_count": {
                  "type": "number",
                  "description": "AI replies in this conversation that used the resource"
                },
                "first_used_at": {
                  "type": "string",
                  "description": "ISO 8601 timestamp of first use in this conversation"
                },
                "last_used_at": {
                  "type": "string",
                  "description": "ISO 8601 timestamp of most recent use"
                }
              },
              "required": [
                "session_id",
                "ticket_number",
                "last_message",
                "reply_count",
                "first_used_at",
                "last_used_at"
              ],
              "additionalProperties": false
            }
          },
          "total_sessions": {
            "type": "number",
            "description": "Distinct conversations matching the lookup"
          }
        },
        "required": [
          "conversations",
          "total_sessions"
        ],
        "additionalProperties": false
      },
      "PublicResourceUsageSummaryDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/PublicResourceUsageSummaryDto",
        "type": "object",
        "properties": {
          "session_count": {
            "type": "number",
            "description": "Distinct conversations that used this resource"
          },
          "applied_sessions": {
            "type": "number",
            "description": "Distinct conversations where the resource was applied"
          },
          "applied_replies": {
            "type": "number",
            "description": "Total applications/invocations"
          },
          "available_sessions": {
            "type": "number",
            "description": "Distinct conversations where an instruction was in context (instructions only)"
          },
          "available_replies": {
            "type": "number"
          },
          "first_used_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "ISO 8601 timestamp of first use"
          },
          "last_used_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "ISO 8601 timestamp of most recent use"
          }
        },
        "required": [
          "session_count",
          "applied_sessions",
          "applied_replies",
          "available_sessions",
          "available_replies",
          "first_used_at",
          "last_used_at"
        ],
        "additionalProperties": false
      },
      "PublicResourceUsageListDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/PublicResourceUsageListDto",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "resource_id": {
                  "type": "string"
                },
                "session_count": {
                  "type": "number",
                  "description": "Distinct conversations that used this resource (usage mirror ∪ handoff citations)"
                },
                "applied_sessions": {
                  "type": "number",
                  "description": "Distinct conversations where the resource was applied"
                },
                "applied_replies": {
                  "type": "number",
                  "description": "Total applications/invocations"
                },
                "available_sessions": {
                  "type": "number",
                  "description": "Distinct conversations where an instruction was in context (instructions only)"
                },
                "available_replies": {
                  "type": "number"
                },
                "handoff_count": {
                  "type": "number",
                  "description": "Distinct conversations that handed off while citing this resource (0 for actions)"
                },
                "first_used_at": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "ISO 8601 timestamp of first use"
                },
                "last_used_at": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "ISO 8601 timestamp of most recent use"
                }
              },
              "required": [
                "resource_id",
                "session_count",
                "applied_sessions",
                "applied_replies",
                "available_sessions",
                "available_replies",
                "handoff_count",
                "first_used_at",
                "last_used_at"
              ],
              "additionalProperties": false
            }
          },
          "next": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "items",
          "next"
        ],
        "additionalProperties": false
      },
      "NumberPoolCallMetricsResponse": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/NumberPoolCallMetricsResponse",
        "type": "object",
        "properties": {
          "scope": {
            "type": "string",
            "const": "sequence_number_pool_calls"
          },
          "start_date": {
            "type": "string"
          },
          "end_date": {
            "type": "string"
          },
          "group_by": {
            "default": "caller_number",
            "description": "Group by recorded pool caller number, UTC day, or 1-based attempt position within a sequence step.",
            "type": "string",
            "enum": [
              "caller_number",
              "day",
              "attempt"
            ]
          },
          "totals": {
            "type": "object",
            "properties": {
              "attempts": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Distinct persisted call attempts; retries count separately."
              },
              "unique_contacts": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Distinct contacts linked to owned call sessions; never sum this across groups."
              },
              "answered": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Attempts settled as human answered by the sequence."
              },
              "voicemail": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "no_answer": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "busy": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Busy or declined attempts, matching the sequence outcome."
              },
              "failed": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Attempts settled as failed, including canceled or missed attempts."
              },
              "pending": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Unsettled attempts still initiating, ringing or in progress."
              },
              "unknown": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Terminal attempts without a recognized pool outcome yet."
              },
              "answer_rate": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Human-answered attempts / all attempts × 100; null when no attempts."
              },
              "connected_seconds": {
                "type": "number",
                "minimum": 0,
                "description": "Sum of answered_at to ended_at for ended connected calls, including voicemail."
              },
              "average_connected_seconds": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Average over ended calls with valid answer/end timestamps; null when none."
              },
              "average_ring_seconds": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Average over calls with a recorded ring duration; null when none."
              }
            },
            "required": [
              "attempts",
              "unique_contacts",
              "answered",
              "voicemail",
              "no_answer",
              "busy",
              "failed",
              "pending",
              "unknown",
              "answer_rate",
              "connected_seconds",
              "average_connected_seconds",
              "average_ring_seconds"
            ],
            "additionalProperties": false
          },
          "rows": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "attempts": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Distinct persisted call attempts; retries count separately."
                },
                "unique_contacts": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Distinct contacts linked to owned call sessions; never sum this across groups."
                },
                "answered": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Attempts settled as human answered by the sequence."
                },
                "voicemail": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "no_answer": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "busy": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Busy or declined attempts, matching the sequence outcome."
                },
                "failed": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Attempts settled as failed, including canceled or missed attempts."
                },
                "pending": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Unsettled attempts still initiating, ringing or in progress."
                },
                "unknown": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Terminal attempts without a recognized pool outcome yet."
                },
                "answer_rate": {
                  "anyOf": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Human-answered attempts / all attempts × 100; null when no attempts."
                },
                "connected_seconds": {
                  "type": "number",
                  "minimum": 0,
                  "description": "Sum of answered_at to ended_at for ended connected calls, including voicemail."
                },
                "average_connected_seconds": {
                  "anyOf": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Average over ended calls with valid answer/end timestamps; null when none."
                },
                "average_ring_seconds": {
                  "anyOf": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Average over calls with a recorded ring duration; null when none."
                },
                "key": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Caller number, UTC date, or attempt position. Null means caller ID was not recorded."
                }
              },
              "required": [
                "attempts",
                "unique_contacts",
                "answered",
                "voicemail",
                "no_answer",
                "busy",
                "failed",
                "pending",
                "unknown",
                "answer_rate",
                "connected_seconds",
                "average_connected_seconds",
                "average_ring_seconds",
                "key"
              ],
              "additionalProperties": false
            }
          },
          "truncated": {
            "type": "boolean",
            "description": "At most 500 groups are returned. Totals cover the full filtered window; narrow filters if true."
          }
        },
        "required": [
          "scope",
          "start_date",
          "end_date",
          "group_by",
          "totals",
          "rows",
          "truncated"
        ],
        "additionalProperties": false
      },
      "DiscoverCampaignPeopleResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/DiscoverCampaignPeopleResponseDto",
        "type": "object",
        "properties": {
          "insights": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "insight_id": {
                  "type": "string"
                },
                "content": {
                  "type": "string"
                },
                "sentiment": {
                  "type": "string"
                },
                "similarity": {
                  "type": "number"
                },
                "occurrence_count": {
                  "type": "number"
                },
                "session_count_in_window": {
                  "type": "number"
                },
                "people_count_in_window": {
                  "type": "number"
                },
                "first_seen_at": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "last_seen_at": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "resolved_at": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "insight_id",
                "content",
                "sentiment",
                "similarity",
                "occurrence_count",
                "session_count_in_window",
                "people_count_in_window",
                "first_seen_at",
                "last_seen_at",
                "resolved_at"
              ],
              "additionalProperties": false
            }
          },
          "people": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "contact_id": {
                  "type": "string"
                },
                "name": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "phone_normalized": {
                  "type": "string"
                },
                "email_normalized": {
                  "type": "string"
                },
                "whatsapp_user_id": {
                  "type": "string"
                },
                "unsubscribed": {
                  "type": "boolean"
                },
                "last_session_at": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "csat_last": {
                  "anyOf": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "matched": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "insight_id": {
                        "type": "string"
                      },
                      "session_ids": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "session_count": {
                        "type": "number"
                      },
                      "resolved_session_count": {
                        "type": "number"
                      },
                      "last_session_at": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "insight_id",
                      "session_ids",
                      "session_count",
                      "resolved_session_count",
                      "last_session_at"
                    ],
                    "additionalProperties": false
                  }
                }
              },
              "required": [
                "contact_id",
                "name",
                "phone_normalized",
                "email_normalized",
                "whatsapp_user_id",
                "unsubscribed",
                "last_session_at",
                "csat_last",
                "matched"
              ],
              "additionalProperties": false
            }
          },
          "total_people": {
            "type": "number"
          },
          "truncated": {
            "type": "boolean"
          },
          "since": {
            "type": "string"
          }
        },
        "required": [
          "insights",
          "people",
          "total_people",
          "truncated",
          "since"
        ],
        "additionalProperties": false
      },
      "ListCustomDataKeysDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ListCustomDataKeysDto",
        "type": "object",
        "properties": {
          "keys": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string"
                },
                "source": {
                  "type": "string",
                  "enum": [
                    "company_custom_data",
                    "contact_custom_data",
                    "contact_non_verified_custom_data",
                    "session_custom_data",
                    "session_editable_custom_data"
                  ],
                  "description": "Which jsonb bag the key was observed in: contact vs session, verified vs not."
                }
              },
              "required": [
                "key",
                "source"
              ],
              "additionalProperties": false
            }
          },
          "total": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "keys",
          "total"
        ],
        "additionalProperties": false
      },
      "SlackConnectionStatusOutputDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SlackConnectionStatusOutputDto",
        "type": "object",
        "properties": {
          "connected": {
            "type": "boolean"
          },
          "workspace_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "workspace_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "connected",
          "workspace_id",
          "workspace_name"
        ],
        "additionalProperties": false
      },
      "SlackBotChannelsOutputDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SlackBotChannelsOutputDto",
        "type": "object",
        "properties": {
          "connected": {
            "type": "boolean"
          },
          "channels": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "Slack channel ID, e.g. C0123456789"
                },
                "name": {
                  "type": "string",
                  "description": "Channel name without the leading #"
                },
                "is_private": {
                  "type": "boolean"
                }
              },
              "required": [
                "id",
                "name",
                "is_private"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "connected",
          "channels"
        ],
        "additionalProperties": false
      },
      "SlackNotificationSettingsOutputDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SlackNotificationSettingsOutputDto",
        "type": "object",
        "properties": {
          "connected": {
            "type": "boolean"
          },
          "notification_channel_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Channel handoff notifications are posted to, or null when they are disabled"
          },
          "notification_channel_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "notify_assignee_enabled": {
            "type": "boolean",
            "description": "Whether the assigned agent is DMed on assignment and handoff, and @mentioned in the Slack thread"
          }
        },
        "required": [
          "connected",
          "notification_channel_id",
          "notification_channel_name",
          "notify_assignee_enabled"
        ],
        "additionalProperties": false
      },
      "SlackTagDirectoryOutputDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SlackTagDirectoryOutputDto",
        "type": "object",
        "properties": {
          "connected": {
            "type": "boolean"
          },
          "tag_directory": {
            "type": "object",
            "propertyNames": {
              "type": "string",
              "minLength": 1
            },
            "additionalProperties": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "usergroup"
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "required": [
                    "type",
                    "id"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "user"
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "required": [
                    "type",
                    "id"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "channel"
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "required": [
                    "type",
                    "id"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "special"
                    },
                    "id": {
                      "type": "string",
                      "enum": [
                        "here",
                        "channel"
                      ]
                    }
                  },
                  "required": [
                    "type",
                    "id"
                  ],
                  "additionalProperties": false
                }
              ]
            }
          }
        },
        "required": [
          "connected",
          "tag_directory"
        ],
        "additionalProperties": false
      },
      "TrainingPublicResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/TrainingPublicResponseDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique training ID"
          },
          "title": {
            "type": "string",
            "description": "The scenario title or trigger phrase (last published version)"
          },
          "content": {
            "type": "string",
            "description": "The instruction body — how the AI should respond (last published version)"
          },
          "draft_title": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Draft title being edited (null if no draft exists). Use draft_title ?? title."
          },
          "draft_content": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Draft body being edited (null if no draft exists). Use draft_content ?? content."
          },
          "type": {
            "type": "string",
            "enum": [
              "BEHAVIORAL",
              "SCENARIO_SPECIFIC"
            ],
            "description": "BEHAVIORAL (always active) or SCENARIO_SPECIFIC (semantic match)"
          },
          "is_draft": {
            "type": "boolean",
            "description": "Draft trainings are saved but not used by the AI"
          },
          "directory_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Directory this training belongs to"
          },
          "restricted_to_channels": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SessionChannel"
            },
            "description": "Channels this applies to (empty = all)"
          },
          "restricted_to_segments": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Contact segments this applies to (empty = all)"
          },
          "current_version": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Active published version number (null if unpublished draft)"
          },
          "metadata": {
            "anyOf": [
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              },
              {
                "type": "null"
              }
            ],
            "description": "Arbitrary key-value metadata for external integrations"
          },
          "published_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "When the current version was published"
          },
          "start_time": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "Active window start (UTC). Null = no start bound."
          },
          "end_time": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "Active window end (UTC). Null = no end bound."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "title",
          "content",
          "draft_title",
          "draft_content",
          "type",
          "is_draft",
          "directory_id",
          "restricted_to_channels",
          "restricted_to_segments",
          "current_version",
          "metadata",
          "published_at",
          "start_time",
          "end_time",
          "created_at",
          "updated_at"
        ],
        "additionalProperties": false
      },
      "DirectoryTreeItem": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/DirectoryTreeItem",
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "org_id": {
            "type": "string"
          },
          "parent_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Parent folder id; null for a top-level folder."
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TrainingPublicResponseDto"
            }
          }
        },
        "required": [
          "id",
          "name",
          "org_id",
          "parent_id",
          "items"
        ],
        "additionalProperties": false
      },
      "TrainingDirectoryTreePublicDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/TrainingDirectoryTreePublicDto",
        "type": "object",
        "properties": {
          "directories": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DirectoryTreeItem"
            }
          },
          "uncategorized": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TrainingPublicResponseDto"
            }
          }
        },
        "required": [
          "directories",
          "uncategorized"
        ],
        "additionalProperties": false
      },
      "OrgUserRole": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/OrgUserRole",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "name": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "name"
        ],
        "additionalProperties": false
      },
      "OrgUserSummary": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/OrgUserSummary",
        "type": "object",
        "properties": {
          "id": {
            "type": "number"
          },
          "uuid": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "name": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "format": "email",
            "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
          },
          "avatar_url": {
            "anyOf": [
              {
                "type": "string",
                "format": "uri"
              },
              {
                "type": "null"
              }
            ]
          },
          "permissions": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "*",
                    "sessions:read",
                    "sessions:write",
                    "team-sessions:read",
                    "team-sessions:write",
                    "assigned-sessions:read",
                    "assigned-sessions:write",
                    "hybrid-inbox:read",
                    "sessions-personal-views:write",
                    "sessions-shared-views:read",
                    "sessions-shared-views:write",
                    "sessions-create:write",
                    "sessions-sub-sessions:write",
                    "merge-sessions:write",
                    "sessions-delete-own-messages:write",
                    "contacts:read",
                    "contacts:write",
                    "companies:read",
                    "companies:write",
                    "sequences:read",
                    "sequences:write",
                    "ai-training:read",
                    "ai-training:write",
                    "reports:read",
                    "reports:write",
                    "help-center:read",
                    "help-center:write",
                    "help-center-content:read",
                    "help-center-content:write",
                    "workflows:read",
                    "workflows:write",
                    "workflows:execute",
                    "actions:read",
                    "actions:write",
                    "mini-apps:read",
                    "mini-apps:write",
                    "companion:read",
                    "companion:write",
                    "redaction:read",
                    "redaction:write",
                    "voc:read",
                    "voc:write",
                    "audit-logs:read",
                    "settings:read",
                    "settings:write",
                    "settings-general:read",
                    "settings-general:write",
                    "settings-billing:read",
                    "settings-billing:write",
                    "settings-api-keys:read",
                    "settings-api-keys:write",
                    "settings-autopilot:read",
                    "settings-autopilot:write",
                    "settings-structured-fields:read",
                    "settings-structured-fields:write",
                    "settings-webhooks:read",
                    "settings-webhooks:write",
                    "settings-secrets:read",
                    "settings-secrets:write",
                    "settings-handoff:read",
                    "settings-handoff:write",
                    "settings-translations:read",
                    "settings-translations:write",
                    "settings-sso:read",
                    "settings-sso:write",
                    "settings-integrations:read",
                    "settings-integrations:write",
                    "settings-members:read",
                    "settings-members:write",
                    "settings-agent-availability:read",
                    "settings-agent-availability:write",
                    "settings-tags:read",
                    "settings-tags:write",
                    "settings-sla:read",
                    "settings-sla:write",
                    "settings-csat:read",
                    "settings-csat:write",
                    "settings-reports:read",
                    "settings-reports:write",
                    "settings-office-hours:read",
                    "settings-office-hours:write",
                    "settings-channels:read",
                    "settings-channels:write",
                    "settings-channels-voice:read",
                    "settings-channels-voice:write",
                    "settings-email-fleet:read",
                    "settings-email-fleet:write",
                    "settings-helpdesk:read",
                    "settings-helpdesk:write",
                    "settings-custom-statuses:read",
                    "settings-custom-statuses:write",
                    "settings-availability-statuses:read",
                    "settings-availability-statuses:write",
                    "settings-personal-profile:read",
                    "settings-personal-profile:write",
                    "settings-groups:read",
                    "settings-groups:write",
                    "settings-roles:read",
                    "settings-roles:write",
                    "settings-macros:read",
                    "settings-macros:write",
                    "settings-skills:read",
                    "settings-skills:write"
                  ]
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "roles": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrgUserRole"
            }
          }
        },
        "required": [
          "id",
          "name",
          "email",
          "roles"
        ],
        "additionalProperties": false
      },
      "OrgUserDetail": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/OrgUserDetail",
        "type": "object",
        "properties": {
          "id": {
            "type": "number"
          },
          "uuid": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "name": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "format": "email",
            "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
          },
          "avatar_url": {
            "anyOf": [
              {
                "type": "string",
                "format": "uri"
              },
              {
                "type": "null"
              }
            ]
          },
          "permissions": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "*",
                    "sessions:read",
                    "sessions:write",
                    "team-sessions:read",
                    "team-sessions:write",
                    "assigned-sessions:read",
                    "assigned-sessions:write",
                    "hybrid-inbox:read",
                    "sessions-personal-views:write",
                    "sessions-shared-views:read",
                    "sessions-shared-views:write",
                    "sessions-create:write",
                    "sessions-sub-sessions:write",
                    "merge-sessions:write",
                    "sessions-delete-own-messages:write",
                    "contacts:read",
                    "contacts:write",
                    "companies:read",
                    "companies:write",
                    "sequences:read",
                    "sequences:write",
                    "ai-training:read",
                    "ai-training:write",
                    "reports:read",
                    "reports:write",
                    "help-center:read",
                    "help-center:write",
                    "help-center-content:read",
                    "help-center-content:write",
                    "workflows:read",
                    "workflows:write",
                    "workflows:execute",
                    "actions:read",
                    "actions:write",
                    "mini-apps:read",
                    "mini-apps:write",
                    "companion:read",
                    "companion:write",
                    "redaction:read",
                    "redaction:write",
                    "voc:read",
                    "voc:write",
                    "audit-logs:read",
                    "settings:read",
                    "settings:write",
                    "settings-general:read",
                    "settings-general:write",
                    "settings-billing:read",
                    "settings-billing:write",
                    "settings-api-keys:read",
                    "settings-api-keys:write",
                    "settings-autopilot:read",
                    "settings-autopilot:write",
                    "settings-structured-fields:read",
                    "settings-structured-fields:write",
                    "settings-webhooks:read",
                    "settings-webhooks:write",
                    "settings-secrets:read",
                    "settings-secrets:write",
                    "settings-handoff:read",
                    "settings-handoff:write",
                    "settings-translations:read",
                    "settings-translations:write",
                    "settings-sso:read",
                    "settings-sso:write",
                    "settings-integrations:read",
                    "settings-integrations:write",
                    "settings-members:read",
                    "settings-members:write",
                    "settings-agent-availability:read",
                    "settings-agent-availability:write",
                    "settings-tags:read",
                    "settings-tags:write",
                    "settings-sla:read",
                    "settings-sla:write",
                    "settings-csat:read",
                    "settings-csat:write",
                    "settings-reports:read",
                    "settings-reports:write",
                    "settings-office-hours:read",
                    "settings-office-hours:write",
                    "settings-channels:read",
                    "settings-channels:write",
                    "settings-channels-voice:read",
                    "settings-channels-voice:write",
                    "settings-email-fleet:read",
                    "settings-email-fleet:write",
                    "settings-helpdesk:read",
                    "settings-helpdesk:write",
                    "settings-custom-statuses:read",
                    "settings-custom-statuses:write",
                    "settings-availability-statuses:read",
                    "settings-availability-statuses:write",
                    "settings-personal-profile:read",
                    "settings-personal-profile:write",
                    "settings-groups:read",
                    "settings-groups:write",
                    "settings-roles:read",
                    "settings-roles:write",
                    "settings-macros:read",
                    "settings-macros:write",
                    "settings-skills:read",
                    "settings-skills:write"
                  ]
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "roles": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrgUserRole"
            }
          },
          "teams": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "group": {
                  "$ref": "#/components/schemas/GroupDto"
                },
                "is_user_available_on_group": {
                  "type": "boolean"
                }
              },
              "required": [
                "group",
                "is_user_available_on_group"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "id",
          "name",
          "email",
          "roles",
          "teams"
        ],
        "additionalProperties": false
      },
      "BatchDeleteOrgUsersResultDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/BatchDeleteOrgUsersResultDto",
        "type": "object",
        "properties": {
          "results": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "user_id": {
                  "type": "number"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "deleted",
                    "not_found",
                    "owner_blocked",
                    "error"
                  ],
                  "description": "deleted: membership removed; not_found: not a member of this organization; owner_blocked: the organization owner cannot be removed; error: removal failed, retry later"
                }
              },
              "required": [
                "user_id",
                "status"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "results"
        ],
        "additionalProperties": false
      },
      "RolePublicDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/RolePublicDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "permissions": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "*",
                "sessions:read",
                "sessions:write",
                "team-sessions:read",
                "team-sessions:write",
                "assigned-sessions:read",
                "assigned-sessions:write",
                "hybrid-inbox:read",
                "sessions-personal-views:write",
                "sessions-shared-views:read",
                "sessions-shared-views:write",
                "sessions-create:write",
                "sessions-sub-sessions:write",
                "merge-sessions:write",
                "sessions-delete-own-messages:write",
                "contacts:read",
                "contacts:write",
                "companies:read",
                "companies:write",
                "sequences:read",
                "sequences:write",
                "ai-training:read",
                "ai-training:write",
                "reports:read",
                "reports:write",
                "help-center:read",
                "help-center:write",
                "help-center-content:read",
                "help-center-content:write",
                "workflows:read",
                "workflows:write",
                "workflows:execute",
                "actions:read",
                "actions:write",
                "mini-apps:read",
                "mini-apps:write",
                "companion:read",
                "companion:write",
                "redaction:read",
                "redaction:write",
                "voc:read",
                "voc:write",
                "audit-logs:read",
                "settings:read",
                "settings:write",
                "settings-general:read",
                "settings-general:write",
                "settings-billing:read",
                "settings-billing:write",
                "settings-api-keys:read",
                "settings-api-keys:write",
                "settings-autopilot:read",
                "settings-autopilot:write",
                "settings-structured-fields:read",
                "settings-structured-fields:write",
                "settings-webhooks:read",
                "settings-webhooks:write",
                "settings-secrets:read",
                "settings-secrets:write",
                "settings-handoff:read",
                "settings-handoff:write",
                "settings-translations:read",
                "settings-translations:write",
                "settings-sso:read",
                "settings-sso:write",
                "settings-integrations:read",
                "settings-integrations:write",
                "settings-members:read",
                "settings-members:write",
                "settings-agent-availability:read",
                "settings-agent-availability:write",
                "settings-tags:read",
                "settings-tags:write",
                "settings-sla:read",
                "settings-sla:write",
                "settings-csat:read",
                "settings-csat:write",
                "settings-reports:read",
                "settings-reports:write",
                "settings-office-hours:read",
                "settings-office-hours:write",
                "settings-channels:read",
                "settings-channels:write",
                "settings-channels-voice:read",
                "settings-channels-voice:write",
                "settings-email-fleet:read",
                "settings-email-fleet:write",
                "settings-helpdesk:read",
                "settings-helpdesk:write",
                "settings-custom-statuses:read",
                "settings-custom-statuses:write",
                "settings-availability-statuses:read",
                "settings-availability-statuses:write",
                "settings-personal-profile:read",
                "settings-personal-profile:write",
                "settings-groups:read",
                "settings-groups:write",
                "settings-roles:read",
                "settings-roles:write",
                "settings-macros:read",
                "settings-macros:write",
                "settings-skills:read",
                "settings-skills:write"
              ]
            }
          }
        },
        "required": [
          "id",
          "name",
          "description",
          "permissions"
        ],
        "additionalProperties": false
      },
      "PublicInsight": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/PublicInsight",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "insight_number": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "content": {
            "type": "string"
          },
          "sentiment": {
            "type": "string",
            "enum": [
              "angry",
              "happy",
              "neutral"
            ]
          },
          "occurrence_count": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "category": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  "name": {
                    "type": "string"
                  },
                  "description": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "id",
                  "name",
                  "description"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "team": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "resolved_by": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "name": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "avatar_url": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "name",
                  "avatar_url"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "resolved_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "archived_by": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "name": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "avatar_url": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "reason": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "name",
                  "avatar_url",
                  "reason"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "archived_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "archive_policy": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "forever",
                  "until_count",
                  "until_escalating"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "resurface_progress": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "current": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "target": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "current",
                  "target"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "deep_research": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "deep_research_completed_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "first_seen_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_seen_at": {
            "type": "string",
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "insight_number",
          "content",
          "sentiment",
          "occurrence_count",
          "category",
          "team",
          "resolved_by",
          "resolved_at",
          "archived_by",
          "archived_at",
          "archive_policy",
          "resurface_progress",
          "deep_research",
          "deep_research_completed_at",
          "first_seen_at",
          "last_seen_at",
          "created_at",
          "updated_at"
        ],
        "additionalProperties": false
      },
      "PublicPaginatedInsightsDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/PublicPaginatedInsightsDto",
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicInsight"
            }
          },
          "page": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "total": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "totalPages": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "data",
          "page",
          "total",
          "totalPages"
        ],
        "additionalProperties": false
      },
      "PublicCategoryDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/PublicCategoryDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "base",
              "suggested",
              "user_defined"
            ]
          }
        },
        "required": [
          "id",
          "name",
          "description",
          "type"
        ],
        "additionalProperties": false
      },
      "PublicCategoryUsageDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/PublicCategoryUsageDto",
        "type": "object",
        "properties": {
          "base": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Active system (base) categories."
          },
          "custom": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Active user-defined (custom) categories."
          },
          "suggested": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Active AI-suggested categories."
          },
          "total": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Total active categories (base + custom + suggested)."
          },
          "limit": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Maximum total categories before the AI stops suggesting new ones."
          }
        },
        "required": [
          "base",
          "custom",
          "suggested",
          "total",
          "limit"
        ],
        "additionalProperties": false
      },
      "PublicBulkCategoryResultDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/PublicBulkCategoryResultDto",
        "type": "object",
        "properties": {
          "succeeded": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicCategoryDto"
            }
          },
          "failed": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "categoryId": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "error": {
                  "type": "string"
                }
              },
              "required": [
                "categoryId",
                "error"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "succeeded",
          "failed"
        ],
        "additionalProperties": false
      },
      "PublicVocSettingsDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/PublicVocSettingsDto",
        "type": "object",
        "properties": {
          "custom_analysis_instructions": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 1000
              },
              {
                "type": "null"
              }
            ],
            "description": "Dashboard: Customer Insights → Settings → AI Instructions. Org-specific analysis constraints injected into the VOC insights analyzer for future runs. Max 1000 chars. Null means unset."
          }
        },
        "required": [
          "custom_analysis_instructions"
        ],
        "additionalProperties": false
      },
      "SendTemplateOutputDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SendTemplateOutputDto",
        "type": "object",
        "properties": {
          "whatsapp_message_id": {
            "type": "string"
          },
          "opencx_message_id": {
            "type": "string"
          },
          "opencx_session_id": {
            "type": "string"
          }
        },
        "required": [
          "whatsapp_message_id",
          "opencx_message_id",
          "opencx_session_id"
        ],
        "additionalProperties": false
      },
      "HelpCenterListItemDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/HelpCenterListItemDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "name"
        ],
        "additionalProperties": false
      },
      "PublicApiHelpCenterDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/PublicApiHelpCenterDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "domain": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "logo_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "primary_language_code": {
            "type": "string"
          },
          "enabled_languages": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "auto_translate": {
            "type": "string",
            "enum": [
              "on_publish",
              "off"
            ],
            "description": "When automatic translation into the other enabled languages runs: after a source-language publish, or never."
          },
          "translation_prompt": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "custom_css": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "custom_head_scripts": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "sidebar_variant": {
            "type": "string",
            "enum": [
              "sidebar",
              "floating",
              "inset"
            ]
          },
          "theme": {
            "type": "string",
            "enum": [
              "default",
              "thmanyah",
              "viva"
            ]
          },
          "localizations": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "object",
              "properties": {
                "title": {
                  "type": "string"
                },
                "description": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "additionalProperties": false
            }
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "name",
          "description",
          "domain",
          "logo_url",
          "primary_language_code",
          "enabled_languages",
          "auto_translate",
          "translation_prompt",
          "custom_css",
          "custom_head_scripts",
          "sidebar_variant",
          "theme",
          "localizations",
          "updated_at"
        ],
        "additionalProperties": false
      },
      "MediaUploadResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/MediaUploadResponseDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the stored file."
          },
          "url": {
            "type": "string",
            "description": "Public URL for the uploaded image."
          }
        },
        "required": [
          "id",
          "url"
        ],
        "additionalProperties": false
      },
      "MediaPublicErrorResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/MediaPublicErrorResponseDto",
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number"
          },
          "message": {
            "type": "string"
          },
          "error": {
            "type": "string"
          }
        },
        "required": [
          "statusCode",
          "message"
        ],
        "additionalProperties": false
      },
      "PhoneAnswerOverviewResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/PhoneAnswerOverviewResponseDto",
        "type": "object",
        "properties": {
          "waits": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Times a caller waited for an agent (finished waits only)."
          },
          "answered": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "caller_hung_up": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "timed_out": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "no_agents": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "voicemail": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "failed": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Waits ended by a call failure on our side. Never graded, not an abandon."
          },
          "met": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Answered within the target."
          },
          "missed": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "excluded": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Left out of the SLA: short abandons, and unanswered waits under answered_only."
          },
          "ungraded": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Waits not graded: no phone answer-time policy applied, or the call failed."
          },
          "compliance_rate": {
            "type": "number",
            "description": "met / (met + missed), 0–1."
          },
          "abandon_rate": {
            "type": "number",
            "description": "caller_hung_up / waits, 0–1."
          },
          "avg_answer_seconds": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Average wait of answered callers."
          },
          "answer_seconds_p50": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "answer_seconds_p90": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "answer_seconds_p95": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "target_percent": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ],
            "description": "The answer-time goal (%) when every graded wait in range used the same policy."
          }
        },
        "required": [
          "waits",
          "answered",
          "caller_hung_up",
          "timed_out",
          "no_agents",
          "voicemail",
          "failed",
          "met",
          "missed",
          "excluded",
          "ungraded",
          "compliance_rate",
          "abandon_rate",
          "avg_answer_seconds",
          "answer_seconds_p50",
          "answer_seconds_p90",
          "answer_seconds_p95",
          "target_percent"
        ],
        "additionalProperties": false
      },
      "PhoneAnswerBreakdownResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/PhoneAnswerBreakdownResponseDto",
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "waits": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991,
              "description": "Times a caller waited for an agent (finished waits only)."
            },
            "answered": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            "caller_hung_up": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            "timed_out": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            "no_agents": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            "voicemail": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            "failed": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991,
              "description": "Waits ended by a call failure on our side. Never graded, not an abandon."
            },
            "met": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991,
              "description": "Answered within the target."
            },
            "missed": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            "excluded": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991,
              "description": "Left out of the SLA: short abandons, and unanswered waits under answered_only."
            },
            "ungraded": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991,
              "description": "Waits not graded: no phone answer-time policy applied, or the call failed."
            },
            "compliance_rate": {
              "type": "number",
              "description": "met / (met + missed), 0–1."
            },
            "abandon_rate": {
              "type": "number",
              "description": "caller_hung_up / waits, 0–1."
            },
            "avg_answer_seconds": {
              "anyOf": [
                {
                  "type": "number"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Average wait of answered callers."
            },
            "answer_seconds_p50": {
              "anyOf": [
                {
                  "type": "number"
                },
                {
                  "type": "null"
                }
              ]
            },
            "answer_seconds_p90": {
              "anyOf": [
                {
                  "type": "number"
                },
                {
                  "type": "null"
                }
              ]
            },
            "answer_seconds_p95": {
              "anyOf": [
                {
                  "type": "number"
                },
                {
                  "type": "null"
                }
              ]
            },
            "grouping": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "team",
                    "policy",
                    "day",
                    "hour"
                  ]
                },
                "id": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "number"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "name": {
                  "type": "string"
                }
              },
              "required": [
                "type",
                "id",
                "name"
              ],
              "additionalProperties": false
            }
          },
          "required": [
            "waits",
            "answered",
            "caller_hung_up",
            "timed_out",
            "no_agents",
            "voicemail",
            "failed",
            "met",
            "missed",
            "excluded",
            "ungraded",
            "compliance_rate",
            "abandon_rate",
            "avg_answer_seconds",
            "answer_seconds_p50",
            "answer_seconds_p90",
            "answer_seconds_p95",
            "grouping"
          ],
          "additionalProperties": false
        }
      },
      "PhoneAnswerAgentsResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/PhoneAnswerAgentsResponseDto",
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "user_id": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            "name": {
              "type": "string"
            },
            "offered": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991,
              "description": "Rings this agent received."
            },
            "answered": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            "declined": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            "missed": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991,
              "description": "Rings that ran out on this agent."
            },
            "canceled": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991,
              "description": "Rings ended by someone else answering or the caller leaving."
            },
            "answer_rate": {
              "type": "number",
              "description": "answered / (answered + declined + missed), 0–1."
            },
            "avg_seconds_to_answer": {
              "anyOf": [
                {
                  "type": "number"
                },
                {
                  "type": "null"
                }
              ],
              "description": "From this agent’s ring to their accept."
            },
            "answered_within_target": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991,
              "description": "Answers given within the target, timed from this agent’s own ring."
            }
          },
          "required": [
            "user_id",
            "name",
            "offered",
            "answered",
            "declined",
            "missed",
            "canceled",
            "answer_rate",
            "avg_seconds_to_answer",
            "answered_within_target"
          ],
          "additionalProperties": false
        }
      },
      "RunReportQueryResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/RunReportQueryResponseDto",
        "type": "object",
        "properties": {
          "rows": {
            "type": "array",
            "items": {
              "type": "object",
              "propertyNames": {
                "type": "string"
              },
              "additionalProperties": {}
            }
          },
          "row_count": {
            "type": "number"
          },
          "truncated": {
            "type": "boolean"
          }
        },
        "required": [
          "rows",
          "row_count",
          "truncated"
        ],
        "additionalProperties": false
      },
      "PartnerOrgDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/PartnerOrgDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "external_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "created_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "name",
          "external_id",
          "tags",
          "created_at"
        ],
        "additionalProperties": false
      },
      "ListPartnerOrgsResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ListPartnerOrgsResponseDto",
        "type": "object",
        "properties": {
          "partner": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PartnerOrgDto"
            }
          },
          "total": {
            "type": "number"
          }
        },
        "required": [
          "partner",
          "data",
          "total"
        ],
        "additionalProperties": false
      },
      "PartnerOrgHealthDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/PartnerOrgHealthDto",
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "external_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "website": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "logo_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "health": {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "healthy",
                  "setup_incomplete",
                  "inactive",
                  "new"
                ]
              },
              "members": {
                "type": "number"
              },
              "data_sources": {
                "type": "number"
              },
              "has_ai_training": {
                "type": "boolean"
              },
              "has_actions": {
                "type": "boolean"
              },
              "sessions_30d": {
                "type": "number"
              },
              "total_sessions": {
                "type": "number"
              },
              "last_session_at": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "status",
              "members",
              "data_sources",
              "has_ai_training",
              "has_actions",
              "sessions_30d",
              "total_sessions",
              "last_session_at"
            ],
            "additionalProperties": false
          },
          "channels": {
            "type": "object",
            "properties": {
              "chat": {
                "type": "boolean"
              },
              "email": {
                "type": "boolean"
              },
              "whatsapp": {
                "type": "boolean"
              },
              "instagram": {
                "type": "boolean"
              },
              "messenger": {
                "type": "boolean"
              },
              "sms": {
                "type": "boolean"
              },
              "voice": {
                "type": "boolean"
              }
            },
            "required": [
              "chat",
              "email",
              "whatsapp",
              "instagram",
              "messenger",
              "sms",
              "voice"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "id",
          "name",
          "external_id",
          "website",
          "logo_url",
          "created_at",
          "tags",
          "health",
          "channels"
        ],
        "additionalProperties": false
      },
      "SearchPartnerOrgsResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SearchPartnerOrgsResponseDto",
        "type": "object",
        "properties": {
          "partner": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PartnerOrgHealthDto"
            }
          },
          "total": {
            "type": "number"
          },
          "limit": {
            "type": "number"
          },
          "offset": {
            "type": "number"
          }
        },
        "required": [
          "partner",
          "data",
          "total",
          "limit",
          "offset"
        ],
        "additionalProperties": false
      },
      "SalesforceMiawWebhookResponse": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SalesforceMiawWebhookResponse",
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "success"
        ],
        "additionalProperties": false
      },
      "CoworkerTodoItem": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CoworkerTodoItem",
        "type": "object",
        "properties": {
          "label": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "in_progress",
              "completed"
            ]
          }
        },
        "required": [
          "label",
          "status"
        ],
        "additionalProperties": false
      },
      "CoworkerTodosResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CoworkerTodosResponseDto",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CoworkerTodoItem"
            }
          }
        },
        "required": [
          "items"
        ],
        "additionalProperties": false
      },
      "ListHelpCenterMediaOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ListHelpCenterMediaOutput",
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/HcMediaFileDto"
        }
      },
      "DeleteHelpCenterMediaOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/DeleteHelpCenterMediaOutput",
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          }
        },
        "required": [
          "success"
        ],
        "additionalProperties": false
      },
      "ActionTagsResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ActionTagsResponseDto",
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "FinishSessionWrapUpResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/FinishSessionWrapUpResponseDto",
        "type": "object",
        "properties": {
          "cleared": {
            "type": "boolean"
          }
        },
        "required": [
          "cleared"
        ],
        "additionalProperties": false
      },
      "ListChatSessionsOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ListChatSessionsOutput",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GetChatSessionOutput"
            }
          },
          "next": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "items",
          "next"
        ],
        "additionalProperties": false
      },
      "FilterChatSessionsOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/FilterChatSessionsOutput",
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GetChatSessionOutput"
            }
          },
          "page": {
            "type": "number"
          },
          "limit": {
            "type": "number"
          },
          "has_next": {
            "type": "boolean"
          },
          "has_previous": {
            "type": "boolean"
          }
        },
        "required": [
          "data",
          "page",
          "limit",
          "has_next",
          "has_previous"
        ],
        "additionalProperties": false
      },
      "SearchPublicResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SearchPublicResponseDto",
        "type": "object",
        "properties": {
          "contacts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "Contact ID"
                },
                "name": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Contact name"
                },
                "email": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Contact email"
                },
                "phone": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Contact phone number"
                }
              },
              "required": [
                "id",
                "name",
                "email",
                "phone"
              ],
              "additionalProperties": false
            }
          },
          "messages": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "Message ID"
                },
                "session_id": {
                  "type": "string",
                  "description": "Session this message belongs to"
                },
                "message": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Message content"
                },
                "type": {
                  "type": "string",
                  "description": "Message type"
                }
              },
              "required": [
                "id",
                "session_id",
                "message",
                "type"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "contacts",
          "messages"
        ],
        "additionalProperties": false
      },
      "ListChatHistoryOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ListChatHistoryOutput",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ChatHistoryOutput"
            }
          },
          "next": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "items",
          "next"
        ],
        "additionalProperties": false
      },
      "SessionHandoffsOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SessionHandoffsOutput",
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "session_id": {
                "type": "string"
              },
              "summary": {
                "type": "string"
              },
              "explanation": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "sentiment": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "reasons": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "ai_implied_handoff",
                    "based_on_instructions",
                    "feature_limit_reached__ai_resolutions",
                    "feature_limit_reached__ai_voice_minutes",
                    "instructions_not_clear",
                    "insufficient_knowledge",
                    "insufficient_tools",
                    "prohibited_topic",
                    "user_requested_human_assistance"
                  ]
                }
              },
              "references": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "reference_type": {
                      "type": "string",
                      "enum": [
                        "ai_profile",
                        "instruction",
                        "knowledge",
                        "prohibited_topic",
                        "tool"
                      ]
                    },
                    "reference_id": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "reference_type",
                    "reference_id"
                  ],
                  "additionalProperties": false
                }
              },
              "created_at": {
                "type": "string",
                "format": "date-time"
              }
            },
            "required": [
              "id",
              "session_id",
              "summary",
              "explanation",
              "sentiment",
              "reasons",
              "references",
              "created_at"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "SessionTagsOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SessionTagsOutput",
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "tag_name": {
              "type": "string"
            },
            "created_at": {
              "type": "string",
              "format": "date-time"
            }
          },
          "required": [
            "tag_name",
            "created_at"
          ],
          "additionalProperties": false
        }
      },
      "ListContactsOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ListContactsOutput",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Contact"
            }
          },
          "next": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "items",
          "next"
        ],
        "additionalProperties": false
      },
      "SearchContactsOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SearchContactsOutput",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Contact"
            }
          },
          "next": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "items",
          "next"
        ],
        "additionalProperties": false
      },
      "ListBlockedContactsOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ListBlockedContactsOutput",
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "Block record ID"
                },
                "contact_id": {
                  "type": "string",
                  "description": "The blocked contact ID"
                },
                "email": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Contact email"
                },
                "name": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Contact name"
                },
                "phone_number": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Contact phone number"
                },
                "reason": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Why the contact was blocked"
                },
                "created_at": {
                  "type": "string",
                  "format": "date-time"
                }
              },
              "required": [
                "id",
                "contact_id",
                "email",
                "name",
                "phone_number",
                "reason",
                "created_at"
              ],
              "additionalProperties": false
            }
          },
          "total": {
            "type": "number"
          },
          "page": {
            "type": "number"
          },
          "total_pages": {
            "type": "number"
          }
        },
        "required": [
          "data",
          "total",
          "page",
          "total_pages"
        ],
        "additionalProperties": false
      },
      "ContactBlockStatusOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ContactBlockStatusOutput",
        "type": "object",
        "properties": {
          "is_blocked": {
            "type": "boolean"
          }
        },
        "required": [
          "is_blocked"
        ],
        "additionalProperties": false
      },
      "ListBlockedDomainsOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ListBlockedDomainsOutput",
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "Block record ID"
                },
                "domain": {
                  "type": "string",
                  "description": "The blocked domain"
                },
                "reason": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Why the domain was blocked"
                },
                "created_at": {
                  "type": "string",
                  "format": "date-time"
                }
              },
              "required": [
                "id",
                "domain",
                "reason",
                "created_at"
              ],
              "additionalProperties": false
            }
          },
          "total": {
            "type": "number"
          },
          "page": {
            "type": "number"
          },
          "total_pages": {
            "type": "number"
          }
        },
        "required": [
          "data",
          "total",
          "page",
          "total_pages"
        ],
        "additionalProperties": false
      },
      "BlockDomainsOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/BlockDomainsOutput",
        "type": "object",
        "properties": {
          "blocked": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "Block record ID"
                },
                "domain": {
                  "type": "string",
                  "description": "The blocked domain"
                },
                "reason": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Why the domain was blocked"
                },
                "created_at": {
                  "type": "string",
                  "format": "date-time"
                }
              },
              "required": [
                "id",
                "domain",
                "reason",
                "created_at"
              ],
              "additionalProperties": false
            },
            "description": "Domains that were successfully blocked"
          },
          "skipped": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Domains that needed no action — already blocked, or not a valid domain"
          },
          "failed": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "domain": {
                  "type": "string"
                },
                "error": {
                  "type": "string"
                }
              },
              "required": [
                "domain",
                "error"
              ],
              "additionalProperties": false
            },
            "description": "Domains that could NOT be blocked — these are still unblocked"
          },
          "summary": {
            "type": "object",
            "properties": {
              "total": {
                "type": "number"
              },
              "blocked": {
                "type": "number"
              },
              "skipped": {
                "type": "number"
              },
              "failed": {
                "type": "number"
              }
            },
            "required": [
              "total",
              "blocked",
              "skipped",
              "failed"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "blocked",
          "skipped",
          "failed",
          "summary"
        ],
        "additionalProperties": false
      },
      "DomainBlockStatusOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/DomainBlockStatusOutput",
        "type": "object",
        "properties": {
          "is_blocked": {
            "type": "boolean"
          }
        },
        "required": [
          "is_blocked"
        ],
        "additionalProperties": false
      },
      "ListBlockedIpsOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ListBlockedIpsOutput",
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "Block record ID"
                },
                "ip_address": {
                  "type": "string",
                  "description": "The blocked address — a single IP (203.0.113.7) or a CIDR range (203.0.113.0/24)"
                },
                "reason": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Why the address was blocked"
                },
                "created_at": {
                  "type": "string",
                  "format": "date-time"
                },
                "expires_at": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "When the block lifts automatically. Null means it never does."
                }
              },
              "required": [
                "id",
                "ip_address",
                "reason",
                "created_at",
                "expires_at"
              ],
              "additionalProperties": false
            }
          },
          "total": {
            "type": "number"
          },
          "page": {
            "type": "number"
          },
          "total_pages": {
            "type": "number"
          }
        },
        "required": [
          "data",
          "total",
          "page",
          "total_pages"
        ],
        "additionalProperties": false
      },
      "BlockIpsOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/BlockIpsOutput",
        "type": "object",
        "properties": {
          "blocked": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "Block record ID"
                },
                "ip_address": {
                  "type": "string",
                  "description": "The blocked address — a single IP (203.0.113.7) or a CIDR range (203.0.113.0/24)"
                },
                "reason": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Why the address was blocked"
                },
                "created_at": {
                  "type": "string",
                  "format": "date-time"
                },
                "expires_at": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "When the block lifts automatically. Null means it never does."
                }
              },
              "required": [
                "id",
                "ip_address",
                "reason",
                "created_at",
                "expires_at"
              ],
              "additionalProperties": false
            },
            "description": "Addresses that were successfully blocked"
          },
          "skipped": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Addresses that needed no action — already blocked, or not a valid IP/CIDR"
          },
          "failed": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "ip": {
                  "type": "string"
                },
                "error": {
                  "type": "string"
                }
              },
              "required": [
                "ip",
                "error"
              ],
              "additionalProperties": false
            },
            "description": "Addresses that could NOT be blocked — these are still unblocked"
          },
          "summary": {
            "type": "object",
            "properties": {
              "total": {
                "type": "number"
              },
              "blocked": {
                "type": "number"
              },
              "skipped": {
                "type": "number"
              },
              "failed": {
                "type": "number"
              }
            },
            "required": [
              "total",
              "blocked",
              "skipped",
              "failed"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "blocked",
          "skipped",
          "failed",
          "summary"
        ],
        "additionalProperties": false
      },
      "IpBlockStatusOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/IpBlockStatusOutput",
        "type": "object",
        "properties": {
          "is_blocked": {
            "type": "boolean"
          }
        },
        "required": [
          "is_blocked"
        ],
        "additionalProperties": false
      },
      "SessionIpActivityOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SessionIpActivityOutput",
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "ip": {
                  "type": "string"
                },
                "session_count": {
                  "type": "number"
                },
                "contact_count": {
                  "type": "number"
                },
                "first_seen": {
                  "type": "string",
                  "format": "date-time"
                },
                "last_seen": {
                  "type": "string",
                  "format": "date-time"
                },
                "is_blocked": {
                  "type": "boolean"
                }
              },
              "required": [
                "ip",
                "session_count",
                "contact_count",
                "first_seen",
                "last_seen",
                "is_blocked"
              ],
              "additionalProperties": false
            }
          },
          "page": {
            "type": "number"
          },
          "has_more": {
            "type": "boolean"
          }
        },
        "required": [
          "data",
          "page",
          "has_more"
        ],
        "additionalProperties": false
      },
      "RemoveFromOutboundBlocklistOutputDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/RemoveFromOutboundBlocklistOutputDto",
        "type": "object",
        "properties": {
          "removed": {
            "type": "number",
            "description": "How many entries were removed."
          },
          "skipped": {
            "type": "number",
            "description": "How many matching entries were left in place because they were not added through this API. When this is above zero the address is still blocked — retry with include_provider_entries=true if you intend to remove those too."
          }
        },
        "required": [
          "removed",
          "skipped"
        ],
        "additionalProperties": false
      },
      "CheckOutboundBlocklistOutputDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/CheckOutboundBlocklistOutputDto",
        "type": "object",
        "properties": {
          "blocked": {
            "type": "boolean"
          },
          "entries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OutboundBlocklistEntryDto"
            }
          }
        },
        "required": [
          "blocked",
          "entries"
        ],
        "additionalProperties": false
      },
      "GetCustomDomainsOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/GetCustomDomainsOutput",
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "domainName": {
              "type": "string"
            },
            "region": {
              "anyOf": [
                {
                  "type": "string",
                  "enum": [
                    "eu-west-1",
                    "us-east-1"
                  ]
                },
                {
                  "type": "null"
                }
              ],
              "description": "Saved sending region, or null for older domains without a recorded region."
            },
            "domainNameVerificationStatus": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "records": {
              "anyOf": [
                {},
                {
                  "type": "null"
                }
              ]
            }
          },
          "required": [
            "domainName",
            "region",
            "domainNameVerificationStatus",
            "records"
          ],
          "additionalProperties": false
        }
      },
      "ListEmailChannelsOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ListEmailChannelsOutput",
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/PublicEmailChannelDto"
        }
      },
      "ListEmailTemplatesOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ListEmailTemplatesOutput",
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/EmailTemplateDto"
        }
      },
      "ListMacrosOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ListMacrosOutput",
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/SavedReplyDto"
        }
      },
      "ListSkillsOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ListSkillsOutput",
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/SkillDto"
        }
      },
      "GetUserSkillsOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/GetUserSkillsOutput",
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/SkillDto"
        }
      },
      "SetUserSkillsOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SetUserSkillsOutput",
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/SkillDto"
        }
      },
      "ListHandoffEventsOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ListHandoffEventsOutput",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "session_id": {
                  "type": "string"
                },
                "summary": {
                  "type": "string"
                },
                "explanation": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "reasons": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "enum": [
                      "ai_implied_handoff",
                      "based_on_instructions",
                      "feature_limit_reached__ai_resolutions",
                      "feature_limit_reached__ai_voice_minutes",
                      "instructions_not_clear",
                      "insufficient_knowledge",
                      "insufficient_tools",
                      "prohibited_topic",
                      "user_requested_human_assistance"
                    ]
                  }
                },
                "sentiment": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "angry",
                        "happy",
                        "neutral"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "created_at": {
                  "type": "string"
                }
              },
              "required": [
                "session_id",
                "summary",
                "explanation",
                "reasons",
                "sentiment",
                "created_at"
              ],
              "additionalProperties": false
            }
          },
          "next": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "total": {
            "type": "number"
          }
        },
        "required": [
          "items",
          "next",
          "total"
        ],
        "additionalProperties": false
      },
      "ListOfficeHoursOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ListOfficeHoursOutput",
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OfficeHoursPublicResponseDto"
            }
          }
        },
        "required": [
          "data"
        ],
        "additionalProperties": false
      },
      "ListTagsOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ListTagsOutput",
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/TagPublicResponseDto"
        }
      },
      "TagsInUseOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/TagsInUseOutput",
        "type": "object",
        "properties": {
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Tag names currently applied to sessions"
          }
        },
        "required": [
          "tags"
        ],
        "additionalProperties": false
      },
      "AutoTaggingStatusOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/AutoTaggingStatusOutput",
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean",
            "description": "Whether AI auto-tagging is enabled"
          }
        },
        "required": [
          "enabled"
        ],
        "additionalProperties": false
      },
      "UpdateAutoTaggingOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/UpdateAutoTaggingOutput",
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean"
          }
        },
        "required": [
          "enabled"
        ],
        "additionalProperties": false
      },
      "ListTagCategoriesOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ListTagCategoriesOutput",
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/TagCategoryPublicResponseDto"
        }
      },
      "ListCustomStatusesOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ListCustomStatusesOutput",
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/CustomSessionStatusDto"
        }
      },
      "DeleteCustomStatusOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/DeleteCustomStatusOutput",
        "type": "object",
        "properties": {
          "message": {
            "type": "string"
          }
        },
        "required": [
          "message"
        ],
        "additionalProperties": false
      },
      "ListInboxViewsOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ListInboxViewsOutput",
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/InboxViewDto"
        }
      },
      "ListWorkflowsOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ListWorkflowsOutput",
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/WorkflowPublicResponseDto"
        }
      },
      "DeleteWorkflowOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/DeleteWorkflowOutput",
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "success",
          "message"
        ],
        "additionalProperties": false
      },
      "ActivateWorkflowOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ActivateWorkflowOutput",
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          }
        },
        "required": [
          "success"
        ],
        "additionalProperties": false
      },
      "DeactivateWorkflowOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/DeactivateWorkflowOutput",
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          }
        },
        "required": [
          "success"
        ],
        "additionalProperties": false
      },
      "InvokeWorkflowResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/InvokeWorkflowResponseDto",
        "type": "object",
        "properties": {
          "run_id": {
            "type": "string",
            "description": "The id of the workflow run"
          },
          "status": {
            "type": "string",
            "enum": [
              "completed",
              "queued"
            ],
            "description": "completed = ran synchronously; queued = running in the background"
          },
          "output": {
            "description": "Terminal output, present when the workflow ran synchronously"
          }
        },
        "required": [
          "run_id",
          "status"
        ],
        "additionalProperties": false
      },
      "ListWorkflowRunsOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ListWorkflowRunsOutput",
        "type": "object",
        "properties": {
          "runs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkflowRunPublicResponseDto"
            }
          },
          "total_items": {
            "type": "number"
          },
          "total_pages": {
            "type": "number"
          },
          "has_next_page": {
            "type": "boolean"
          },
          "current_page": {
            "type": "number"
          }
        },
        "required": [
          "runs",
          "total_items",
          "total_pages",
          "has_next_page",
          "current_page"
        ],
        "additionalProperties": false
      },
      "GetWorkflowRunStepsOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/GetWorkflowRunStepsOutput",
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/SelectWorkflowRunStepDto"
        }
      },
      "GetWorkflowRunLogsOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/GetWorkflowRunLogsOutput",
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/WorkflowRunLogEntryDto"
        }
      },
      "ListVoicesOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ListVoicesOutput",
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/PhoneAgentVoiceDto"
        }
      },
      "ListVerifiedPhoneNumbersOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ListVerifiedPhoneNumbersOutput",
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/VerifiedPhoneNumberDto"
        }
      },
      "ListPhoneAgentsOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ListPhoneAgentsOutput",
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/PhoneAgentDto"
        }
      },
      "ListTransferDestinationsOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ListTransferDestinationsOutput",
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/TransferDestinationDto"
        }
      },
      "ListTrainingsOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ListTrainingsOutput",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TrainingPublicResponseDto"
            }
          },
          "total": {
            "type": "number",
            "description": "Total matching items before pagination"
          },
          "limit": {
            "type": "number"
          },
          "offset": {
            "type": "number"
          },
          "has_more": {
            "type": "boolean",
            "description": "Whether more items exist beyond this page"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset",
          "has_more"
        ],
        "additionalProperties": false
      },
      "SearchTrainingKnowledgeResponseDto": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SearchTrainingKnowledgeResponseDto",
        "type": "object",
        "properties": {
          "results": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "title": {
                  "type": "string"
                },
                "visibility": {
                  "type": "string",
                  "enum": [
                    "internal",
                    "public"
                  ]
                },
                "source_type": {
                  "type": "string",
                  "enum": [
                    "custom_training",
                    "help_center",
                    "integration",
                    "website",
                    "workflow"
                  ]
                },
                "source_url": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "updated_at": {
                  "type": "string",
                  "format": "date-time"
                },
                "content": {
                  "type": "string"
                },
                "data_source": {
                  "type": "string",
                  "enum": [
                    "confluence",
                    "notion",
                    "zendesk_support",
                    "shopify",
                    "gitbook",
                    "intercom",
                    "front",
                    "freshdesk",
                    "hubspot_kb",
                    "ai_instructions",
                    "custom_training",
                    "website",
                    "workflow",
                    "help_center"
                  ]
                },
                "stream": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "relevance_score": {
                  "type": "number",
                  "minimum": 0,
                  "maximum": 100
                },
                "directory_id": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "directory_name": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "is_draft": {
                  "type": "boolean"
                },
                "usage_count": {
                  "default": 0,
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "restricted_to_segments": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "restricted_to_channels": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "start_time": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "end_time": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "content_preview": {
                  "type": "string",
                  "description": "First 500 characters of content"
                }
              },
              "required": [
                "id",
                "title",
                "visibility",
                "source_type",
                "source_url",
                "updated_at",
                "data_source",
                "stream",
                "relevance_score",
                "directory_id",
                "directory_name",
                "usage_count",
                "content_preview"
              ],
              "additionalProperties": false
            }
          },
          "total_count": {
            "type": "number"
          }
        },
        "required": [
          "results",
          "total_count"
        ],
        "additionalProperties": false
      },
      "AiProfileOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/AiProfileOutput",
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "prompt_message": {
            "type": "string"
          },
          "draft_prompt_message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "guard_rails_instructions": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "language": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "name",
          "prompt_message",
          "draft_prompt_message",
          "guard_rails_instructions",
          "language"
        ],
        "additionalProperties": false
      },
      "PublishAiProfileDraftOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/PublishAiProfileDraftOutput",
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          }
        },
        "required": [
          "success"
        ],
        "additionalProperties": false
      },
      "DiscardAiProfileDraftOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/DiscardAiProfileDraftOutput",
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          }
        },
        "required": [
          "success"
        ],
        "additionalProperties": false
      },
      "TestConnectionOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/TestConnectionOutput",
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          }
        },
        "required": [
          "ok"
        ],
        "additionalProperties": false
      },
      "SimulatePhoneRingOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/SimulatePhoneRingOutput",
        "type": "object",
        "properties": {
          "sessionId": {
            "type": "string"
          },
          "ringStartedAt": {
            "type": "number"
          },
          "ringExpiresAt": {
            "type": "number"
          },
          "rangUserIds": {
            "type": "array",
            "items": {
              "type": "number"
            }
          }
        },
        "required": [
          "sessionId",
          "ringStartedAt",
          "ringExpiresAt",
          "rangUserIds"
        ],
        "additionalProperties": false
      },
      "ListHelpCentersOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ListHelpCentersOutput",
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/HelpCenterListItemDto"
        }
      },
      "ListHelpCenterTranslationJobsOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ListHelpCenterTranslationJobsOutput",
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/TranslationJobResponseDto"
        }
      },
      "ListHelpCenterGlossaryTermsOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ListHelpCenterGlossaryTermsOutput",
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/GlossaryTermDto"
        }
      },
      "ImportHelpCenterGlossaryTermsOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/ImportHelpCenterGlossaryTermsOutput",
        "type": "object",
        "properties": {
          "imported_count": {
            "type": "number"
          }
        },
        "required": [
          "imported_count"
        ],
        "additionalProperties": false
      },
      "DeleteHelpCenterGlossaryTermOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/DeleteHelpCenterGlossaryTermOutput",
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          }
        },
        "required": [
          "success"
        ],
        "additionalProperties": false
      },
      "DeleteHelpCenterTopicOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/DeleteHelpCenterTopicOutput",
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          }
        },
        "required": [
          "success"
        ],
        "additionalProperties": false
      },
      "DeleteHelpCenterArticleOutput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "$id": "#/components/schemas/DeleteHelpCenterArticleOutput",
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          }
        },
        "required": [
          "success"
        ],
        "additionalProperties": false
      },
      "ErrorDto": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "integer"
          },
          "message": {
            "type": "string"
          },
          "error": {
            "type": "string"
          }
        }
      }
    }
  },
  "paths": {
    "/actions": {
      "get": {
        "operationId": "listActions",
        "summary": "List all actions",
        "description": "List all actions configured for your organization. Actions are HTTP API calls the AI agent can make during conversations.",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ActionPublicResponseDto"
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createAction",
        "summary": "Create an action",
        "description": "Create a new action that the AI agent can call during conversations. The payload field uses OpenAPI-style parameter and request body specifications to define how the API call should be constructed.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateActionPublicDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ActionPublicResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/actions/tags": {
      "get": {
        "operationId": "listActionTags",
        "summary": "List distinct action tags",
        "description": "Get all unique tags used across actions in your organization.",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ActionTagsResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/actions/{action_id}": {
      "get": {
        "operationId": "getAction",
        "summary": "Get an action",
        "description": "Get a single action by ID.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "action_id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ActionPublicResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateAction",
        "summary": "Update an action",
        "description": "Update an existing action. Only provided fields are changed. Use `restricted_to_segments` to limit the action to contacts in those segments (empty array = available to all contacts; omit to leave unchanged).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateActionPublicDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "action_id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ActionPublicResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteAction",
        "summary": "Delete an action",
        "description": "Permanently delete a single action by ID.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "action_id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response"
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/actions/{operation_id}/invoke": {
      "post": {
        "operationId": "invokeAction",
        "summary": "Invoke an action",
        "description": "Run a configured action the same way the AI agent runs it in a conversation — make the action’s configured HTTP request and return the upstream status and body. Addressed by operation_id (the handle the agent uses). The target URL comes only from the action configuration, never the request. With `context.sessionId`, the request is decorated with the same in-session context the agent attaches (org globals, contact identity, default headers, and — off web — per-contact backend auth), so a caller embedded in a conversation invokes the action with the agent’s context; without it, only org globals apply. Actions requiring a form still execute — supplying the inputs is the submission.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InvokeActionDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "operation_id",
            "required": true
          }
        ],
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvokeActionResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/actions/all": {
      "delete": {
        "operationId": "deleteAllActions",
        "summary": "Delete all actions",
        "description": "Delete all actions. This is safe when you can re-import from an OpenAPI spec. Manually created dashboard actions will also be deleted.",
        "responses": {
          "200": {
            "description": "Default Response"
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/actions/import": {
      "put": {
        "operationId": "importActionsFromOpenApiSpec",
        "summary": "Import actions from OpenAPI spec",
        "description": "Upload an OpenAPI specification file (v2, v3, or v3.1; YAML or JSON). Actions are created for each operation in the spec. Previous imports from the same spec are replaced.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FileUploadDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response"
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/agent-availability/me/wrap-up/ready": {
      "post": {
        "operationId": "finishSessionWrapUp",
        "summary": "Finish your wrap-up for a closed phone session",
        "description": "End only the authenticated teammate’s wrap-up for the supplied closed phone session. Requires a user-bound token. Does not close the session, change availability, or clear wrap-up belonging to another session. Returns cleared=false when no matching wrap-up remains.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FinishSessionWrapUpBodyDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FinishSessionWrapUpResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/agent-availability/{userId}": {
      "put": {
        "operationId": "updateAgentAvailability",
        "summary": "Update agent availability",
        "description": "Update an agent's availability status and per-agent chat capacity. The agent must belong to the API key's organization.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateAgentAvailabilityPublicDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            },
            "in": "path",
            "name": "userId",
            "required": true,
            "description": "Organization user ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentAvailability"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/audit-logs": {
      "get": {
        "operationId": "listAuditLogs",
        "summary": "List audit logs",
        "description": "Query the audit log to see who changed what and when, including teammate sign-ins and sign-outs. Returns change events newest first with before/after diffs. Page with `page`, or pass the `next_cursor` of the previous response as `cursor` for stable, faster paging.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
            },
            "in": "query",
            "name": "startDate",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
            },
            "in": "query",
            "name": "endDate",
            "required": false
          },
          {
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "minLength": 1
                },
                {
                  "minItems": 1,
                  "type": "array",
                  "items": {
                    "type": "string",
                    "minLength": 1
                  }
                }
              ]
            },
            "in": "query",
            "name": "entityType",
            "required": false,
            "description": "Repeat to match any of several. Known values: organization, chat_session, custom_session_status, chat_history, consumer, user, group, group_user, role, user_role, skill, user_skills, action, workflow, flow_variable, api_key, openapi_spec, twilio_credential, twitter_account, sunshine_integration, shopify_settings, airbyte_connection, email_channel, custom_domain, sequence, outbound_email, help_center, help_center_category, help_center_article, ai_instruction, website_data_source, pdf_data_source, ai_phone_agent, call_history, teammate_call, analytics, voc_insight, ai_evaluation, organization_model_version, organization_tags_definition, organization_draft_mode_settings, webhook_endpoint, agent_availability, csat_score, csat_settings, agent_assignment_settings, ai_context_custom_data_filters, alert_rule, pii_redaction_settings, security_notification_settings, mini_app, mini_app_version, mcp_server, mcp_connection, organization_secret."
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "query",
            "name": "entityId",
            "required": false
          },
          {
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "minLength": 1
                },
                {
                  "minItems": 1,
                  "type": "array",
                  "items": {
                    "type": "string",
                    "minLength": 1
                  }
                }
              ]
            },
            "in": "query",
            "name": "eventType",
            "required": false,
            "description": "Repeat to match any of several. Known values: create, update, delete, archive, restore, delete_multiple, unpublish, login, logout, password_change, password_reset, token_create, token_revoke, settings_update, handoff_settings_update, translation_settings_update, integration_connect, mcp_tool_call, access_token_retrieved, integration_disconnect, webhook_create, webhook_update, webhook_delete, permission_grant, permission_revoke, api_key_create, api_key_delete, twitter_chat_passcode_reveal, user_invite, user_invite_accept, user_remove, email_send, message_send, teammate_call_started, teammate_call_ended, conference_participant_invited, conference_participant_removed, session_takeover, session_assignee_update, organization_update, organization_ai_profile_update, organization_global_variable_delete, update_agent_availability_status, redaction, message_deleted, user_invite_delete, user_invite_resend, user_invite_link_copied, alert_rule.created, alert_rule.updated, alert_rule.deleted, publish, share."
          },
          {
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "enum": [
                    "access",
                    "agent_availability",
                    "communication",
                    "configuration",
                    "data",
                    "security"
                  ]
                },
                {
                  "minItems": 1,
                  "type": "array",
                  "items": {
                    "type": "string",
                    "enum": [
                      "access",
                      "agent_availability",
                      "communication",
                      "configuration",
                      "data",
                      "security"
                    ]
                  }
                }
              ]
            },
            "in": "query",
            "name": "eventCategory",
            "required": false,
            "description": "Repeat to match any of several."
          },
          {
            "schema": {
              "type": "number"
            },
            "in": "query",
            "name": "actorId",
            "required": false
          },
          {
            "schema": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            },
            "in": "query",
            "name": "userId",
            "required": false,
            "description": "Events by or about this teammate: everything they did, plus sign-outs the system ended for them."
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "api",
                "system",
                "user"
              ]
            },
            "in": "query",
            "name": "actorType",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "query",
            "name": "cursor",
            "required": false,
            "description": "`next_cursor` from the previous response. When set, `page` is ignored."
          },
          {
            "schema": {
              "default": 1,
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "in": "query",
            "name": "page",
            "required": false
          },
          {
            "schema": {
              "default": 20,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "in": "query",
            "name": "limit",
            "required": false
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuditLogsPublicResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/availability-statuses": {
      "get": {
        "operationId": "listAvailabilityStatuses",
        "summary": "List availability statuses",
        "description": "List the organization's defined availability statuses (excluding deleted ones), ordered as shown in the dashboard. Each status carries its availability_type (whether applying it sets the user online or offline) and its display color. The hardcoded 'online' and 'offline' shortcuts are not listed — they are always applicable via the special field of applyUserAvailabilityStatus.",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AvailabilityStatusDto"
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/availability-statuses/users": {
      "get": {
        "operationId": "getUsersAvailabilityStatuses",
        "summary": "Get users availability statuses (bulk)",
        "description": "Resolve availability for up to 100 users in one call — same per-user shape as getUserAvailabilityStatus, ordered by user id. Ids that are unknown or outside the API key's organization are silently skipped, so the response only contains org members.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "user_ids",
            "required": true,
            "description": "Comma-separated organization user IDs, max 100 (e.g. \"12,34,56\")"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/UserAvailabilityStatusDto"
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/availability-statuses/users/{user_id}": {
      "get": {
        "operationId": "getUserAvailabilityStatus",
        "summary": "Get user availability status",
        "description": "Get a user's current availability: the raw availability record, the resolved status (an applied defined status, or the derived online / offline / mixed state), and the full per-support-team switch matrix. The user must belong to the API key's organization.",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            },
            "in": "path",
            "name": "user_id",
            "required": true,
            "description": "Organization user ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserAvailabilityStatusDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "applyUserAvailabilityStatus",
        "summary": "Apply user availability status",
        "description": "Apply a defined availability status (status_id) or a hardcoded shortcut (special: 'online' | 'offline') to a user, switching their main availability and per-support-team availability exactly like the dashboard status picker. If both fields are sent, special wins. Responds with the user's resulting resolved availability. The user must belong to the API key's organization.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApplyUserAvailabilityStatusDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            },
            "in": "path",
            "name": "user_id",
            "required": true,
            "description": "Organization user ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserAvailabilityStatusDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/chat/sessions/events": {
      "get": {
        "operationId": "listSessionEvents",
        "summary": "Export session events",
        "description": "Pull existing session history across your organization, including system events and internal notes. Uses the same id, created_at and typed event structure as GET /chat/sessions/{session_id}/history, with session/contact IDs, the stored message_type and export metadata. Types without a history mapping are retained as unmapped_event; checkpoint payloads are omitted. created_after is inclusive; created_before is exclusive. Both date bounds are optional. include_message_types overrides exclude_message_types; neither filter returns all message types. Returns recorded actor identities, assignment targets, sub-status IDs and workflow details when available. Does not reconstruct missing historical identities or track session/contact attribute changes. Use a fixed date window when paging, retain the same filters, and deduplicate by event ID. Timestamps are event times: historical imports can arrive later and edits do not change original creation times; reconcile previously exported windows to pick up late or edited history. Requires chat-sessions:read.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
            },
            "in": "query",
            "name": "created_after",
            "required": false,
            "description": "Inclusive event timestamp lower bound."
          },
          {
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
            },
            "in": "query",
            "name": "created_before",
            "required": false,
            "description": "Exclusive event timestamp upper bound."
          },
          {
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              ]
            },
            "in": "query",
            "name": "include_message_types",
            "required": false,
            "description": "Comma-separated types to include. When present, exclude_message_types is ignored."
          },
          {
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              ]
            },
            "in": "query",
            "name": "exclude_message_types",
            "required": false,
            "description": "Comma-separated types to exclude. With neither filter, all event types are returned."
          },
          {
            "schema": {
              "default": 100,
              "type": "integer",
              "minimum": 1,
              "maximum": 250
            },
            "in": "query",
            "name": "limit",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 4096
            },
            "in": "query",
            "name": "cursor",
            "required": false
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionEventsPublicResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/chat/sessions/{session_id}/merge": {
      "post": {
        "operationId": "mergeSessions",
        "summary": "Merge sessions",
        "description": "Permanently close source sessions and attach them to this primary. Sources cannot be reopened or replied to. All replies use the primary channel and recipients. Requires merge-sessions:write and OpenCX or Zendesk ticketing. Reuse idempotencyKey with the identical request when retrying.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MergeSessionsInput"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "session_id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MergeSessionsResult"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/chat/sessions": {
      "post": {
        "operationId": "createChatSession",
        "summary": "Create a chat session",
        "description": "Creates a new chat session for the organization.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateChatSessionInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateChatSessionOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listChatSessions",
        "summary": "List chat sessions",
        "description": "Returns a paginated list of chat sessions for the organization. Supports filtering by status, channel, handoff state, and date ranges. Companion searches may briefly lag recent changes and return an error when unavailable or too large; date ranges have no fixed maximum.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "cursor",
            "required": false,
            "description": "Pagination cursor to fetch the next set of results"
          },
          {
            "schema": {
              "type": "boolean"
            },
            "in": "query",
            "name": "handed_off",
            "required": false,
            "description": "Filter by handoff status. Use \"true\" or \"false\""
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "open",
                "closed_resolved",
                "closed_unresolved"
              ]
            },
            "in": "query",
            "name": "status",
            "required": false,
            "description": "Filter by session status (open, closed_resolved, closed_unresolved)"
          },
          {
            "schema": {
              "$ref": "#/components/schemas/SessionChannel"
            },
            "in": "query",
            "name": "channel_type",
            "required": false
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "created_after",
            "required": false,
            "description": "Filter sessions created after this ISO 8601 timestamp"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "created_before",
            "required": false,
            "description": "Filter sessions created before this ISO 8601 timestamp"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "updated_after",
            "required": false,
            "description": "Filter sessions updated after this ISO 8601 timestamp"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "updated_before",
            "required": false,
            "description": "Filter sessions updated before this ISO 8601 timestamp"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListChatSessionsOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/chat/sessions/filter": {
      "post": {
        "operationId": "filterChatSessions",
        "summary": "Filter chat sessions",
        "description": "Search and filter chat sessions with advanced criteria. Supports filtering by date range, channels, status, sentiment, tags, assignees, teams, contacts, language, custom data, and more. Results are paginated and sortable. Companion searches may briefly lag recent changes and return an error when unavailable or too large; date ranges have no fixed maximum.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FilterSessionsPublicDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FilterChatSessionsOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/chat/sessions/search": {
      "get": {
        "operationId": "searchContactsAndMessages",
        "summary": "Search contacts and messages",
        "description": "Full-text search across contacts (by name, email, phone) and chat messages. Returns matching contacts and messages with their session IDs. Pass `contact_id` to scope message hits to a single contact — strongly recommended for customer-facing workflows so the response can never leak another customer’s messages.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "query",
            "name": "q",
            "required": true,
            "description": "Search query (a name, email, phone, or keyword)"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "query",
            "name": "contact_id",
            "required": false,
            "description": "Restrict message hits to sessions belonging to this contact. When set, the contacts[] response is also restricted to this contact (no BM25 fan-out)."
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchPublicResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/chat/sessions/ticket/{ticket_number}/investigation": {
      "get": {
        "operationId": "getChatSessionInvestigationByTicketNumber",
        "summary": "Investigate a chat session by ticket number",
        "description": "Returns an investigation bundle for a ticket, including session summary, recent history, handoff evidence, tags, CSAT, and rule-based diagnostics.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "ticket_number",
            "required": true,
            "description": "The exact ticket number, e.g. 4521 or #4521"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChatSessionInvestigationPublicResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/chat/sessions/ticket/{ticket_number}": {
      "get": {
        "operationId": "getChatSessionByTicketNumber",
        "summary": "Get a chat session by ticket number",
        "description": "Retrieves a specific chat session by exact ticket number.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "ticket_number",
            "required": true,
            "description": "The exact ticket number, e.g. 4521 or #4521"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetChatSessionOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/chat/sessions/{session_id}": {
      "get": {
        "operationId": "getChatSession",
        "summary": "Get a chat session",
        "description": "Retrieves details of a specific chat session by its ID.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "session_id",
            "required": true,
            "description": "The unique identifier of the chat session"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetChatSessionDetailOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateChatSession",
        "summary": "Update a chat session",
        "description": "Updates a chat session. Can change status, set or clear the summary, generate summary/sentiment on resolve, and reflect status changes to integrations.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateChatSessionInput"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "session_id",
            "required": true,
            "description": "The unique identifier of the chat session"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response"
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/chat/sessions/{session_id}/handoff": {
      "post": {
        "operationId": "handoffChatSession",
        "summary": "Hand the session off to a human agent",
        "description": "Hands the session off to a human agent, re-running the handoff pipeline even if the session is already handed off. Closed sessions are refused with 400.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "session_id",
            "required": true,
            "description": "The unique identifier of the chat session"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HandoffSessionOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/chat/sessions/{session_id}/assignee": {
      "post": {
        "operationId": "assignChatSession",
        "summary": "Assign or unassign a chat session",
        "description": "Assign a chat session to a human agent, named either by `assignee_id` or by `assignee_email` — exactly one. The email is matched case-insensitively against this organization’s members, so a sync can assign straight from the address it already holds. Send either field as null to unassign. A teammate who is not a member of this organization is rejected. Assigning the AI agent is refused with a 429 `feature_limit_reached` error while the organization’s monthly AI resolutions limit is reached.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SessionAssigneeUpdateInput"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "session_id",
            "required": true,
            "description": "The unique identifier of the chat session"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionAssigneeUpdateOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/chat/sessions/{session_id}/team": {
      "post": {
        "operationId": "transferChatSessionToTeam",
        "summary": "Transfer a chat session to a team",
        "description": "Assign or transfer a chat session to a support team. The service will preserve routing intent and may auto-assign an available agent in that team.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SessionTeamTransferInput"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "session_id",
            "required": true,
            "description": "The unique identifier of the chat session"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionTeamTransferOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/chat/sessions/{session_id}/tags": {
      "post": {
        "operationId": "addChatSessionTag",
        "summary": "Add a tag to a chat session",
        "description": "Adds a tag to the session and syncs it with the underlying ticketing system when applicable.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SessionTagMutationInput"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "session_id",
            "required": true,
            "description": "The unique identifier of the chat session"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionTagMutationOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "getSessionTags",
        "summary": "Get session tags",
        "description": "Returns all tags applied to a session.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "session_id",
            "required": true,
            "description": "The unique identifier of the chat session"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionTagsOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/chat/sessions/{session_id}/tags/{tag_name}": {
      "delete": {
        "operationId": "removeChatSessionTag",
        "summary": "Remove a tag from a chat session",
        "description": "Removes a tag from the session and the underlying ticketing system when applicable.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "session_id",
            "required": true,
            "description": "The unique identifier of the chat session"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "tag_name",
            "required": true,
            "description": "Tag name applied to the session"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionTagMutationOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/chat/sessions/{session_id}/sub-status": {
      "put": {
        "operationId": "setChatSessionSubStatus",
        "summary": "Set the custom status of a chat session",
        "description": "Apply a custom status (see GET /custom-statuses) to the session. The session moves to the custom status's built-in parent: an open-parented status reopens a closed session, a closed-parented one closes it, with the same side effects as the dashboard (timeline events, ticketing-system sync, workflow triggers). Replaces any custom status already on the session.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetChatSessionSubStatusInput"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "session_id",
            "required": true,
            "description": "The unique identifier of the chat session"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetChatSessionOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "clearChatSessionSubStatus",
        "summary": "Clear the custom status of a chat session",
        "description": "Remove the custom status from the session. The built-in status (open / closed_resolved / closed_unresolved) is left exactly as it is, so clearing on a closed session does not reopen or re-close it. To change the built-in status use PATCH /chat/sessions/{session_id}.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "session_id",
            "required": true,
            "description": "The unique identifier of the chat session"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetChatSessionOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/chat/sessions/{session_id}/send": {
      "post": {
        "operationId": "sendMessage",
        "summary": "Send a message",
        "description": "Sends a message in a chat session. The message can be sent as either a contact or an agent.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SendMessageInput"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "session_id",
            "required": true,
            "description": "The unique identifier of the chat session"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SendMessageOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/chat/sessions/{session_id}/comments": {
      "post": {
        "operationId": "createChatSessionComment",
        "summary": "Create a session comment",
        "description": "Creates an internal note on the chat session, visible to agents only. Pass thread_id to attach it to a message; omit it for a session-level note.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSessionCommentInput"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "session_id",
            "required": true,
            "description": "The unique identifier of the chat session"
          }
        ],
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChatHistoryDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/chat/sessions/{session_id}/comments/{comment_uuid}": {
      "patch": {
        "operationId": "updateChatSessionComment",
        "summary": "Update a session comment",
        "description": "Replaces the content of an internal comment. Only the comment's author may edit it, and a deleted comment can no longer be edited.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSessionCommentInput"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "session_id",
            "required": true,
            "description": "The unique identifier of the chat session"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "comment_uuid",
            "required": true,
            "description": "The unique identifier of the comment"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChatHistoryDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteChatSessionComment",
        "summary": "Delete a session comment",
        "description": "Soft-deletes an internal comment. Only the comment's author may delete it. The acting agent is passed as the `agent_id` query parameter.",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            },
            "in": "query",
            "name": "agent_id",
            "required": true,
            "description": "Agent user ID performing the deletion. Only the note's author may delete it."
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "session_id",
            "required": true,
            "description": "The unique identifier of the chat session"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "comment_uuid",
            "required": true,
            "description": "The unique identifier of the comment"
          }
        ],
        "responses": {
          "204": {
            "description": "Default Response"
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/chat/sessions/{session_id}/history": {
      "get": {
        "operationId": "listChatHistory",
        "summary": "List chat session history",
        "description": "Returns a paginated list of events (messages, handoffs, status changes, etc.) for a chat session.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "cursor",
            "required": false,
            "description": "Pagination cursor to fetch the next set of results"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "session_id",
            "required": true,
            "description": "The unique identifier of the chat session"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListChatHistoryOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/chat/sessions/{session_id}/handoffs": {
      "get": {
        "operationId": "getSessionHandoffs",
        "summary": "Get session handoff event",
        "description": "Returns the handoff event for a session, including reasons and referenced resources.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "session_id",
            "required": true,
            "description": "The unique identifier of the chat session"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionHandoffsOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/chat/sessions/{session_id}/structured-field-values": {
      "get": {
        "operationId": "getSessionStructuredFieldValues",
        "summary": "Get session structured field values",
        "description": "Returns the Structured Field values recorded on a session, each with its `field_key`, plus `applicable_field_ids`: the fields that currently apply to it once every \"show when\" rule is resolved. A field missing from that list is hidden for this session: it holds no value and rejects writes until its parent field matches.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "session_id",
            "required": true,
            "description": "The unique identifier of the chat session"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionStructuredFieldValueListDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "setSessionStructuredFieldValues",
        "summary": "Set session structured field values",
        "description": "Upserts Structured Field values on a session; `null` clears a field. Name each field by `field_id` or by its `field_key` (the API name); send Boolean and Number values as JSON `true`/`false` and numbers, or as strings. Every value is validated against its live field definition (an enum leaf choice, a user/team/tag of the organization, or a typed scalar), and a bad entry rejects the whole batch. A value on a field whose \"show when\" rule is unmet after the batch is rejected with 400; set the parent field in the same batch instead. Values whose field stops applying because a parent changed are cleared automatically. Returns the full current list with `applicable_field_ids`.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetSessionStructuredFieldValuesDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "session_id",
            "required": true,
            "description": "The unique identifier of the chat session"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionStructuredFieldValueListDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/chat/sessions/investigate-debug": {
      "post": {
        "operationId": "investigateSessionDebug",
        "summary": "Investigate and debug a chat session",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InvestigateSessionDebugInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response"
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/chat/sessions/{session_id}/follow-ups": {
      "post": {
        "operationId": "createChatSessionFollowUp",
        "summary": "Schedule an AI follow-up on a chat session",
        "description": "Schedules the AI to continue this session later with the given prompt as guidance. At most 5 pending and 50 total follow-ups per session (409 when exceeded). Requires the scheduled follow-ups feature (403 otherwise).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateChatSessionFollowUpInput"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "session_id",
            "required": true,
            "description": "The unique identifier of the chat session"
          }
        ],
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChatSessionFollowUpOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listChatSessionFollowUps",
        "summary": "List the AI follow-ups scheduled on a chat session",
        "description": "Every follow-up scheduled on this session, pending ones first. A follow-up stays listed after it fires or is cancelled, with `is_active` false.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "session_id",
            "required": true,
            "description": "The unique identifier of the chat session"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChatSessionFollowUpListOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/chat/sessions/{session_id}/follow-ups/{follow_up_id}": {
      "delete": {
        "operationId": "cancelChatSessionFollowUp",
        "summary": "Cancel a pending AI follow-up",
        "description": "Cancels a pending follow-up so it never fires. Cancelling one that already fired or was cancelled is a no-op and returns it as is.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "session_id",
            "required": true,
            "description": "The unique identifier of the chat session"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "follow_up_id",
            "required": true,
            "description": "The follow-up id returned when it was scheduled"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChatSessionFollowUpOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/companies": {
      "post": {
        "operationId": "upsertCompany",
        "summary": "Create or update a company",
        "description": "Upsert a company by the organization's own key (`external_id`). Creates it when unknown, otherwise merges into the existing record. `name` is required only when creating. Attributes merge — send an attribute as null to clear it.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpsertCompanyDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Company"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listCompanies",
        "summary": "List companies",
        "description": "List the organization companies, newest first.",
        "parameters": [
          {
            "schema": {
              "default": 1,
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "in": "query",
            "name": "page",
            "required": false
          },
          {
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            },
            "in": "query",
            "name": "limit",
            "required": false
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListCompaniesOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/companies/links": {
      "post": {
        "operationId": "bulkLinkContactsToCompanies",
        "summary": "Link many contacts to companies",
        "description": "Links up to 100 contacts in one call. Name each contact by `contact_id`, `contact_email`, or `contact_phone` — exactly one — so a sync can link straight from the identifiers it already holds. Each result carries the resolved `contact_id`. Failures are isolated: a contact that cannot be linked returns an error in its own result entry and does not affect the others, so the call succeeds even when some links do not. Results come back in request order.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BulkLinkContactsDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BulkLinkContactsOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/companies/search": {
      "post": {
        "operationId": "searchCompanies",
        "summary": "Search companies",
        "description": "Filter, search and sort the organization companies: by owning teammate, by attribute conditions (all must hold), and by a substring of the name or external id.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SearchCompaniesInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListCompaniesOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/companies/{company_id}": {
      "get": {
        "operationId": "getCompany",
        "summary": "Retrieve a company",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "company_id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Company"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/companies/{external_id}/owner": {
      "put": {
        "operationId": "setCompanyOwner",
        "summary": "Set a company's owning teammate",
        "description": "Assigns the teammate who owns this account, named either by `agent_owner_id` or by `agent_owner_email` — exactly one. The email is matched case-insensitively against this organization's members, so a sync can assign straight from the address it already holds. Send either field as null to clear the owner. A teammate who is not a member of this organization is rejected, as is the AI user.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetCompanyOwnerDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "external_id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Company"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/contacts": {
      "post": {
        "operationId": "saveContact",
        "summary": "Create a contact",
        "description": "Create a new contact",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveContactInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SaveContactOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listContacts",
        "summary": "List contacts",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "cursor",
            "required": false,
            "description": "Pagination cursor to fetch the next set of results"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "created_after",
            "required": false,
            "description": "Filter contacts created after this ISO 8601 timestamp"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "created_before",
            "required": false,
            "description": "Filter contacts created before this ISO 8601 timestamp"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "updated_after",
            "required": false,
            "description": "Filter contacts updated after this ISO 8601 timestamp"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "updated_before",
            "required": false,
            "description": "Filter contacts updated before this ISO 8601 timestamp"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListContactsOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/contacts/{contact_id}": {
      "delete": {
        "operationId": "deleteContact",
        "summary": "Delete a contact",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "contact_id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response"
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "getContact",
        "summary": "Get a contact",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "contact_id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Contact"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateContact",
        "summary": "Update a contact",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateContactInput"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "contact_id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response"
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/contacts/{contact_id}/structured-field-values": {
      "get": {
        "operationId": "getContactStructuredFieldValues",
        "summary": "Get contact structured field values",
        "description": "Returns the Structured Field values recorded on a contact, each with its `field_key`, plus `applicable_field_ids`: the fields that currently apply to it once every \"show when\" rule is resolved. A field missing from that list is hidden for this contact: it holds no value and rejects writes until its parent field matches.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "contact_id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactStructuredFieldValueListDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "setContactStructuredFieldValues",
        "summary": "Set contact structured field values",
        "description": "Upserts Structured Field values on a contact; `null` clears a field. Name each field by `field_id` or by its `field_key` (the API name); send Boolean and Number values as JSON `true`/`false` and numbers, or as strings. Fields are the same definitions sessions use; a contact holds its own values. Every value is validated against its live field definition (an enum leaf choice, a user/team/tag of the organization, or a typed scalar), and a bad entry rejects the whole batch. A value on a field whose \"show when\" rule is unmet after the batch is rejected with 400; set the parent field in the same batch instead. Values whose field stops applying because a parent changed are cleared automatically. Returns the full current list with `applicable_field_ids`.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetContactStructuredFieldValuesDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "contact_id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactStructuredFieldValueListDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/contacts/search": {
      "post": {
        "operationId": "searchContacts",
        "summary": "Search contacts",
        "description": "Search contacts using composite filters (OR of AND groups). Each rule narrows the set; groups are combined with OR logic.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SearchContactsInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchContactsOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/contacts/segments": {
      "post": {
        "operationId": "createContactSegment",
        "summary": "Create a contact segment",
        "description": "Create a saved contact filter. Requires segments:write. Membership is calculated in the background.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateContactSegmentInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactSegment"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listContactSegments",
        "summary": "List contact segments",
        "description": "List contact segment definitions for the organization",
        "parameters": [
          {
            "schema": {
              "default": 1,
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "in": "query",
            "name": "page",
            "required": false
          },
          {
            "schema": {
              "default": 20,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "in": "query",
            "name": "limit",
            "required": false
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListContactSegmentsOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/contacts/segments/{segment_id}": {
      "patch": {
        "operationId": "updateContactSegment",
        "summary": "Update a contact segment",
        "description": "Update only supplied fields. A supplied definition replaces all filter rules; membership is recalculated in the background when rules change. Requires segments:write.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateContactSegmentInput"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "segment_id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactSegment"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteContactSegment",
        "summary": "Delete a contact segment",
        "description": "Permanently delete a segment definition and its stored memberships, without deleting contacts. Requires segments:write.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "segment_id",
            "required": true
          }
        ],
        "responses": {
          "204": {
            "description": "Default Response"
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "getContactSegment",
        "summary": "Get a contact segment",
        "description": "Get a contact segment definition by id",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "segment_id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactSegment"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/contacts/segments/contacts/{contact_id}": {
      "get": {
        "operationId": "listSegmentsForContact",
        "summary": "List segments for a contact",
        "description": "List all segments that a contact currently belongs to",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "contact_id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListSegmentsForContactOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/contacts/segments/{segment_id}/contacts/{contact_id}": {
      "get": {
        "operationId": "checkContactInSegment",
        "summary": "Check contact segment membership",
        "description": "Check whether a contact is a member of a specific segment",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "segment_id",
            "required": true
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "contact_id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckContactInSegmentOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/contacts/{contact_id}/companies": {
      "get": {
        "operationId": "getContactCompanies",
        "summary": "List a contact's companies",
        "description": "Returns every company this contact belongs to, newest link first. An empty list is the ordinary state for a contact in none.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "contact_id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetContactCompaniesOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "linkContactToCompany",
        "summary": "Add a company to a contact",
        "description": "Links the contact to an EXISTING company, resolved by the organization's own key (`external_id`). Unknown keys are rejected rather than creating a company. A contact may belong to several companies, so this adds rather than replaces; linking the same company twice reports `unchanged`.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LinkContactCompanyDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "contact_id",
            "required": true
          }
        ],
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LinkContactCompanyOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/contacts/{contact_id}/companies/{external_id}": {
      "delete": {
        "operationId": "unlinkContactFromCompany",
        "summary": "Remove one company from a contact",
        "description": "Removes the link to that one company and leaves the contact's other companies alone. Reports `unchanged` when the contact was not in that company.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "contact_id",
            "required": true
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "external_id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnlinkContactCompanyOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/crawl": {
      "post": {
        "operationId": "createCrawlDatasource",
        "summary": "Create a website datasource",
        "tags": [
          "Crawl"
        ],
        "description": "Create a new website datasource and optionally start an initial crawl. Crawled content is automatically indexed into your knowledge base.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateWebsiteDatasourceDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CrawlDatasource"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listCrawlDatasources",
        "summary": "List website datasources",
        "tags": [
          "Crawl"
        ],
        "description": "Retrieve a paginated list of all website datasources for your organization.",
        "parameters": [
          {
            "schema": {
              "default": 1,
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "in": "query",
            "name": "page",
            "required": false
          },
          {
            "schema": {
              "default": 20,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "in": "query",
            "name": "limit",
            "required": false
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CrawlDatasourceListResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/crawl/{id}": {
      "get": {
        "operationId": "getCrawlDatasource",
        "summary": "Get website datasource details",
        "tags": [
          "Crawl"
        ],
        "description": "Retrieve a website datasource with page statistics and active crawl job information.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "The website datasource ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CrawlDatasourceDetail"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateCrawlDatasource",
        "summary": "Update website datasource settings",
        "tags": [
          "Crawl"
        ],
        "description": "Update configuration for a website datasource. Changes to crawl interval or status automatically reschedule crawls.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateWebsiteDatasourceDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "The website datasource ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CrawlDatasource"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteCrawlDatasource",
        "summary": "Delete a website datasource",
        "tags": [
          "Crawl"
        ],
        "description": "Delete a website datasource and all its crawl jobs and pages. Optionally delete linked knowledge base items via the delete_kb_items query parameter.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "delete_kb_items",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "The website datasource ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "success"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/crawl/{id}/crawl": {
      "post": {
        "operationId": "startCrawl",
        "summary": "Start a new crawl",
        "tags": [
          "Crawl"
        ],
        "description": "Start a new crawl for the given website datasource. Only one crawl can be active per datasource at a time.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "The website datasource ID"
          }
        ],
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CrawlJob"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "cancelCrawl",
        "summary": "Cancel active crawl",
        "tags": [
          "Crawl"
        ],
        "description": "Cancel the currently active crawl for the given website datasource.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "The website datasource ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "success"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/crawl/{id}/crawls": {
      "get": {
        "operationId": "listCrawlJobs",
        "summary": "List crawl history",
        "tags": [
          "Crawl"
        ],
        "description": "Retrieve a paginated list of crawl jobs for a website datasource.",
        "parameters": [
          {
            "schema": {
              "default": 1,
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "in": "query",
            "name": "page",
            "required": false
          },
          {
            "schema": {
              "default": 10,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "in": "query",
            "name": "limit",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "The website datasource ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CrawlJobListResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/crawl/{id}/crawls/{jobId}": {
      "get": {
        "operationId": "getCrawlJob",
        "summary": "Get crawl job status",
        "tags": [
          "Crawl"
        ],
        "description": "Retrieve the status and details of a specific crawl job.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "The website datasource ID"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "jobId",
            "required": true,
            "description": "The crawl job ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CrawlJob"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/crawl/{id}/pages": {
      "get": {
        "operationId": "listCrawlPages",
        "summary": "List crawled pages",
        "tags": [
          "Crawl"
        ],
        "description": "Retrieve a paginated list of pages for a website datasource. Filter by sync status or search by URL/title.",
        "parameters": [
          {
            "schema": {
              "default": 1,
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "in": "query",
            "name": "page",
            "required": false
          },
          {
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "in": "query",
            "name": "limit",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "synced",
                "error",
                "excluded"
              ]
            },
            "in": "query",
            "name": "sync_status",
            "required": false
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "search",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "The website datasource ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CrawlPageListResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/crawl/{id}/pages/exclude": {
      "post": {
        "operationId": "excludeCrawlPages",
        "summary": "Exclude pages from sync",
        "tags": [
          "Crawl"
        ],
        "description": "Bulk exclude pages from future syncs. Excluding a page deletes its knowledge base content so the AI no longer surfaces it, and skips it on future crawls. Re-including a page requeues it for the next crawl to rebuild its content.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BulkPageActionDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "The website datasource ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "excluded": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "excluded"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/crawl/{id}/pages/include": {
      "post": {
        "operationId": "includeCrawlPages",
        "summary": "Include excluded pages back into sync",
        "tags": [
          "Crawl"
        ],
        "description": "Bulk include previously excluded pages back into the sync cycle.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BulkPageActionDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "The website datasource ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "included": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "included"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/crawl/{id}/pages/delete": {
      "post": {
        "operationId": "deleteCrawlPages",
        "summary": "Delete pages",
        "tags": [
          "Crawl"
        ],
        "description": "Bulk delete pages from a website datasource. Optionally delete linked knowledge base items.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeletePagesDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "The website datasource ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "deleted": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "deleted"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/crawl/{id}/pages/sync": {
      "post": {
        "operationId": "syncCrawlPageByUrl",
        "summary": "Scrape and sync a page by URL",
        "tags": [
          "Crawl"
        ],
        "description": "Scrape a URL and sync its content to the knowledge base. If the page already exists in the datasource it is re-scraped; otherwise a new page record is created.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SyncPageByUrlDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "The website datasource ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "success"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/crawl/{id}/pages/{pageId}/resync": {
      "post": {
        "operationId": "resyncCrawlPage",
        "summary": "Resync a single page",
        "tags": [
          "Crawl"
        ],
        "description": "Re-scrape and re-sync a single page to the knowledge base with the latest content.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "The website datasource ID"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "pageId",
            "required": true,
            "description": "The page ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "success"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/knowledgebase-items": {
      "get": {
        "operationId": "listKnowledgebaseItems",
        "summary": "List knowledge base items",
        "tags": [
          "Knowledge Base"
        ],
        "description": "List knowledge base items synced from external data sources (website, Confluence, Notion, etc.). Use this to find item ids and inspect their contact-segment restrictions.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "search",
            "required": false,
            "description": "Full-text search over item titles/content"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "confluence",
                "notion",
                "zendesk_support",
                "shopify",
                "gitbook",
                "intercom",
                "front",
                "freshdesk",
                "hubspot_kb",
                "ai_instructions",
                "custom_training",
                "website",
                "workflow",
                "help_center"
              ]
            },
            "in": "query",
            "name": "data_source",
            "required": false,
            "description": "Filter to a specific external data source (e.g. website, confluence, notion)"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "internal",
                "public"
              ]
            },
            "in": "query",
            "name": "visibility",
            "required": false
          },
          {
            "schema": {
              "default": 1,
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "in": "query",
            "name": "page",
            "required": false
          },
          {
            "schema": {
              "default": 20,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "in": "query",
            "name": "limit",
            "required": false
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListPublicKnowledgebaseItemsOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/knowledgebase-items/{id}": {
      "put": {
        "operationId": "updateKnowledgebaseItem",
        "summary": "Update a knowledge base item",
        "tags": [
          "Knowledge Base"
        ],
        "description": "Update a knowledge base item. Primarily used to set `restricted_to_segments` so the AI only uses the item for contacts in the given segments (empty = all contacts).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdatePublicKnowledgebaseItem"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "The knowledge base item id"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicKnowledgebaseItem"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/csat/scores": {
      "get": {
        "operationId": "getCsatScores",
        "summary": "Get all CSAT scores",
        "description": "Retrieve all CSAT scores for the organization with pagination",
        "parameters": [
          {
            "schema": {
              "type": "number"
            },
            "in": "query",
            "name": "page",
            "required": false
          },
          {
            "schema": {
              "type": "number"
            },
            "in": "query",
            "name": "per_page",
            "required": false
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedCsatScoresPublicResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/csat/scores/{score_id}": {
      "get": {
        "operationId": "getCsatScore",
        "summary": "Get specific CSAT score",
        "description": "Retrieve details of a specific CSAT score",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "score_id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CsatScorePublicResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/csat/scores/session/{session_id}": {
      "get": {
        "operationId": "getCsatScoreBySession",
        "summary": "Get session CSAT score",
        "description": "Retrieve CSAT score for a specific session",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "session_id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CsatScorePublicResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/csat/settings/channel/{channel}": {
      "get": {
        "operationId": "isCsatEnabledForChannel",
        "summary": "Check if CSAT is enabled for a channel",
        "description": "Check whether CSAT collection is enabled for the specified channel",
        "parameters": [
          {
            "schema": {
              "$ref": "#/components/schemas/SessionChannel"
            },
            "in": "path",
            "name": "channel",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "channel": {
                      "type": "string"
                    },
                    "enabled": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "channel",
                    "enabled"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/csat/sessions/{session_id}/sent": {
      "get": {
        "operationId": "hasSessionCsatSent",
        "summary": "Check if CSAT has been sent for a session",
        "description": "Check whether a CSAT request has been sent for the specified session",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "session_id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "session_id": {
                      "type": "string"
                    },
                    "csat_sent": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "session_id",
                    "csat_sent"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/csat/settings": {
      "get": {
        "operationId": "getCsatSettings",
        "summary": "Get CSAT settings",
        "description": "Retrieve the CSAT settings for your organization: per-channel toggles plus the custom feedback-page and request-email template overrides (web_template_html, email_template_html, email_template_subject). A null template field means the default OpenCX design is used.",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CsatSettingsResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateCsatSettings",
        "summary": "Update CSAT settings",
        "description": "Partially update the CSAT settings for your organization. Omitted keys are preserved; sending an explicit null (or a whitespace-only string) for a template field clears it back to the default OpenCX design. The web template must include a submit affordance (data-csat-score, data-csat-submit, or OpenCX.csat.submit(...)) and the email template must reference at least one rating link variable ({{score_link_1}}–{{score_link_5}} or {{csat_link}}), otherwise the request is rejected with 400.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateCsatSettingsDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CsatSettingsResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/structured-fields": {
      "get": {
        "operationId": "listStructuredFields",
        "summary": "List Structured Fields",
        "description": "List every Structured Field for the organization, including each enum field’s complete choice tree.",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StructuredFieldListDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createStructuredField",
        "summary": "Create a structured field",
        "description": "Create a new structured field definition. `key` is its immutable, API-safe identifier (lowercase letters, numbers, underscores) — workflows reference it by this key, so choose carefully; neither `key` nor `type` can be changed after creation. Enum choices are authored separately. Field definitions never accept a default value. Pass `group_id` to file it under a structured field group; a `show_when` parent must be in the same group.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateStructuredFieldDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StructuredFieldTreeDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/structured-fields/{fieldId}": {
      "patch": {
        "operationId": "updateStructuredField",
        "summary": "Update a structured field",
        "description": "Update a structured field’s display name, description, `show_when` rule, or group (`group_id`, `null` to ungroup). The key and type are immutable, and field definitions never accept a default value. A field can only depend on, or be depended on by, fields in its own group, so to move linked fields, remove the rule, move each field, then add the rule back.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateStructuredFieldDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "fieldId",
            "required": true,
            "description": "Structured Field ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StructuredFieldTreeDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteStructuredField",
        "summary": "Delete a structured field",
        "description": "Delete a Structured Field. It must have zero Choices first — remove every Choice (deepest first) before deleting the Structured Field itself.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "fieldId",
            "required": true,
            "description": "Structured Field ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StructuredFieldsPublicMessageDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/structured-fields/{fieldId}/variants": {
      "post": {
        "operationId": "createStructuredFieldChoice",
        "summary": "Create a structured field choice",
        "description": "Create a Choice under a Structured Field, optionally nested under another Choice via `parent_id`. `value` is its immutable, API-safe identifier that workflows read/write — choose a short, stable slug. Structured Fields can be nested up to 10 levels deep and hold at most 1000 Choices total.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateStructuredFieldVariantDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "fieldId",
            "required": true,
            "description": "Structured Field ID"
          }
        ],
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StructuredFieldVariantTreeDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/structured-fields/{fieldId}/variants/{optionId}": {
      "patch": {
        "operationId": "updateStructuredFieldChoice",
        "summary": "Rename, redescribe, or re-parent a structured field choice",
        "description": "Update a Choice’s display name and/or description, or move it to a new parent (or to the root) by setting `parent_id`. The immutable `value` cannot be changed.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateStructuredFieldVariantDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "fieldId",
            "required": true,
            "description": "Structured Field ID"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "optionId",
            "required": true,
            "description": "Choice ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StructuredFieldVariantTreeDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteStructuredFieldChoice",
        "summary": "Delete a structured field choice",
        "description": "Delete a Choice. It must have zero children first — remove every descendant (deepest first) before deleting an ancestor.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "fieldId",
            "required": true,
            "description": "Structured Field ID"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "optionId",
            "required": true,
            "description": "Choice ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StructuredFieldsPublicMessageDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/structured-fields/groups": {
      "get": {
        "operationId": "listStructuredFieldGroups",
        "summary": "List structured field groups",
        "description": "List the organization’s structured field groups in display order. A field’s `group_id` points at one of these; `null` means ungrouped.",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StructuredFieldGroupListDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createStructuredFieldGroup",
        "summary": "Create a structured field group",
        "description": "Create a named group to organize structured fields (for example \"QA\" or \"Session details\"). Names are unique per organization, case-insensitively. Groups only organize fields: a field behaves the same in any group. `description` is optional; a blank value stores none.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateStructuredFieldGroupDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StructuredFieldGroupDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/structured-fields/groups/{groupId}": {
      "patch": {
        "operationId": "updateStructuredFieldGroup",
        "summary": "Update a structured field group",
        "description": "Rename a structured field group or change its description. Pass `description: null` (or a blank string) to remove it.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateStructuredFieldGroupDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "groupId",
            "required": true,
            "description": "Structured Field Group ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StructuredFieldGroupDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteStructuredFieldGroup",
        "summary": "Delete a structured field group",
        "description": "Delete a structured field group. It must hold no structured fields first — move each field to another group (or ungroup it) or delete it.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "groupId",
            "required": true,
            "description": "Structured Field Group ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StructuredFieldsPublicMessageDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/autopilot": {
      "get": {
        "operationId": "getAutopilotStatus",
        "summary": "Get autopilot status",
        "description": "Get the autopilot enabled/disabled status for each channel. When autopilot is enabled on a channel, the AI automatically responds to customer messages.",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutopilotStatusResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "updateAutopilotStatus",
        "summary": "Enable or disable autopilot for a channel",
        "description": "Turn autopilot on or off for a specific channel. When disabled, the AI will not automatically respond on that channel — conversations go directly to human agents.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateAutopilotInputDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutopilotStatusResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/autopilot/prohibited-topics": {
      "get": {
        "operationId": "listProhibitedTopics",
        "summary": "List prohibited topics",
        "description": "List the org-wide prohibited topics (also called unapproved themes). When the AI detects that a conversation is about one of these topics, it hands off to a human agent (subject to per-channel handoff behavior settings).",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProhibitedTopicsResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "updateProhibitedTopics",
        "summary": "Replace prohibited topics",
        "description": "Replace the full list of prohibited topics. Pass an empty array to clear all topics. Blank entries and case-insensitive duplicates are removed. When the AI detects a conversation about any of these topics, it hands off to a human.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateProhibitedTopicsInputDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProhibitedTopicsResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/blocklist/contacts": {
      "get": {
        "operationId": "listBlockedContacts",
        "summary": "List blocked contacts",
        "description": "List all blocked contacts. Blocked contacts are ignored by the AI — their messages will not trigger any automated responses.",
        "parameters": [
          {
            "schema": {
              "default": 1,
              "type": "number"
            },
            "in": "query",
            "name": "page",
            "required": false,
            "description": "Page number (default: 1)"
          },
          {
            "schema": {
              "default": 20,
              "type": "number"
            },
            "in": "query",
            "name": "limit",
            "required": false,
            "description": "Results per page (default: 20)"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListBlockedContactsOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "blockContact",
        "summary": "Block a contact",
        "description": "Block a contact by email. The AI will stop responding to messages from this contact.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BlockContactInputDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response"
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/blocklist/contacts/check/{contact_id}": {
      "get": {
        "operationId": "checkContactBlocked",
        "summary": "Check if a contact is blocked",
        "description": "Check whether a specific contact is currently blocked.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "contact_id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactBlockStatusOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/blocklist/contacts/{id}": {
      "delete": {
        "operationId": "unblockContact",
        "summary": "Unblock a contact",
        "description": "Remove a contact from the blocklist. The AI will resume responding to them.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "The block record ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response"
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/blocklist/domains": {
      "get": {
        "operationId": "listBlockedDomains",
        "summary": "List blocked domains",
        "description": "List all blocked email domains. Messages from contacts with emails on blocked domains are ignored by the AI.",
        "parameters": [
          {
            "schema": {
              "default": 1,
              "type": "number"
            },
            "in": "query",
            "name": "page",
            "required": false,
            "description": "Page number (default: 1)"
          },
          {
            "schema": {
              "default": 20,
              "type": "number"
            },
            "in": "query",
            "name": "limit",
            "required": false,
            "description": "Results per page (default: 20)"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListBlockedDomainsOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "blockDomains",
        "summary": "Block email domains",
        "description": "Block one or more email domains. Pass a comma-separated string for multiple domains (e.g. \"spam.com, junk.org\"). Messages from contacts with emails on these domains will be ignored.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BlockDomainsInputDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BlockDomainsOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/blocklist/domains/check": {
      "get": {
        "operationId": "checkDomainBlocked",
        "summary": "Check if a domain or email is blocked",
        "description": "Check whether a domain is blocked. You can pass either a bare domain (e.g. \"spam.com\") or a full email (e.g. \"user@spam.com\") — the domain will be extracted automatically.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "value",
            "required": true,
            "description": "A domain (e.g. \"spam.com\") or email (e.g. \"user@spam.com\")"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DomainBlockStatusOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/blocklist/domains/{id}": {
      "delete": {
        "operationId": "unblockDomain",
        "summary": "Unblock a domain",
        "description": "Remove a domain from the blocklist.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "The block record ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response"
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/blocklist/ips": {
      "get": {
        "operationId": "listBlockedIps",
        "summary": "List blocked IPs",
        "description": "List all blocked IP addresses and CIDR ranges. Visitors on these addresses cannot interact with the AI assistant.",
        "parameters": [
          {
            "schema": {
              "default": 1,
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "in": "query",
            "name": "page",
            "required": false,
            "description": "Page number (default: 1)"
          },
          {
            "schema": {
              "default": 20,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            },
            "in": "query",
            "name": "limit",
            "required": false,
            "description": "Results per page (default: 20, max: 200)"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListBlockedIpsOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "blockIps",
        "summary": "Block IP addresses",
        "description": "Block one or more IP addresses or CIDR ranges. Pass a comma-separated string for multiple values (e.g. \"203.0.113.7, 198.51.100.0/24\"). Both IPv4 and IPv6 are supported. Applies to web widget traffic: email and WhatsApp reach us through the provider’s servers and carry no visitor IP, so block those by domain or contact instead. A session first seen on the widget from a blocked address does stay blocked if it later continues on another channel.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BlockIpsInputDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BlockIpsOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/blocklist/ips/check": {
      "get": {
        "operationId": "checkIpBlocked",
        "summary": "Check if an IP is blocked",
        "description": "Check whether an IP address is blocked. Matches both exact entries and any CIDR range that contains the address.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "value",
            "required": true,
            "description": "An IP address (e.g. \"203.0.113.7\" or \"2001:db8::1\")"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IpBlockStatusOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/blocklist/ips/session-activity": {
      "get": {
        "operationId": "listSessionIpActivity",
        "summary": "List IP addresses seen in recent sessions",
        "description": "Which IP addresses have been opening sessions, ranked by volume, with the number of distinct contacts seen from each. A high contact count against a single address is the signature of one visitor minting a throwaway contact per message. Use this to decide what to block instead of guessing at addresses. Covers widget channels only — other channels carry no client IP.",
        "parameters": [
          {
            "schema": {
              "default": 30,
              "type": "integer",
              "minimum": 1,
              "maximum": 90
            },
            "in": "query",
            "name": "days",
            "required": false,
            "description": "How far back to look (default: 30, max: 90)"
          },
          {
            "schema": {
              "default": 1,
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "in": "query",
            "name": "page",
            "required": false,
            "description": "Page (default: 1)"
          },
          {
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            },
            "in": "query",
            "name": "limit",
            "required": false,
            "description": "Results per page (default: 50, max: 200)"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionIpActivityOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/blocklist/ips/{id}": {
      "delete": {
        "operationId": "unblockIp",
        "summary": "Unblock an IP",
        "description": "Remove an IP address or CIDR range from the blocklist.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "The block record ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response"
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/outbound/blocklist": {
      "post": {
        "operationId": "addToOutboundBlocklist",
        "summary": "Block an address from outbound contact",
        "description": "Adds a phone number, email address, or WhatsApp user id to the do-not-contact list. Sequences will not contact a blocked address on any channel.\n\nSafe to call repeatedly — blocking an address that is already blocked updates the existing entry instead of failing, so retrying a queued job is harmless.\n\nBlocking only ever strengthens: re-blocking an address never shortens an existing expiry and never makes a permanent block temporary. Use the unblock endpoint to lift a block.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AddToOutboundBlocklistDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutboundBlocklistEntryDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "removeFromOutboundBlocklist",
        "summary": "Unblock an address",
        "description": "Removes an address from the do-not-contact list so it can be contacted again.\n\nBy default this only removes entries added through this API. Two kinds are left in place: entries created when someone opted out themselves, and entries that cover a single channel. Both are reported as `skipped` — pass `include_provider_entries=true` to remove them too.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "enum": [
                "phone",
                "email",
                "whatsapp_user_id"
              ]
            },
            "in": "query",
            "name": "identity_type",
            "required": true,
            "description": "What kind of address this is. \"phone\" is stored in international format, \"email\" is lowercased, and \"whatsapp_user_id\" is the WhatsApp id of a contact whose phone number is hidden."
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 320
            },
            "in": "query",
            "name": "identity_value",
            "required": true,
            "description": "The address itself — e.g. \"+962790007001\" or \"lead@example.com\"."
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "include_provider_entries",
            "required": false,
            "description": "Send \"true\" to also remove entries recorded when the person opted out themselves, and entries scoped to a single channel. Accepts \"true\" or \"false\"; defaults to \"false\"."
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RemoveFromOutboundBlocklistOutputDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listOutboundBlocklist",
        "summary": "List blocked addresses",
        "description": "Lists the do-not-contact list, newest first. Includes both entries you added and entries recorded when people opted out themselves — check `source` to tell them apart.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "enum": [
                "phone",
                "email",
                "whatsapp_user_id"
              ]
            },
            "in": "query",
            "name": "identity_type",
            "required": false,
            "description": "What kind of address this is. \"phone\" is stored in international format, \"email\" is lowercased, and \"whatsapp_user_id\" is the WhatsApp id of a contact whose phone number is hidden."
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "cursor",
            "required": false,
            "description": "Cursor from a previous response."
          },
          {
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            },
            "in": "query",
            "name": "limit",
            "required": false
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/OutboundBlocklistEntryDto"
                      }
                    },
                    "next": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "next"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/outbound/blocklist/check": {
      "get": {
        "operationId": "checkOutboundBlocklist",
        "summary": "Check whether an address is blocked",
        "description": "Tells you whether an address is currently on the do-not-contact list. Expired entries do not count as blocked.\n\n`blocked` means the address is suppressed on at least one channel — check the `channel` on each returned entry to see which. Note this answers for the address you ask about: someone reachable on WhatsApp without a known phone number is a separate identity, so block the WhatsApp user id too if you have it.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "enum": [
                "phone",
                "email",
                "whatsapp_user_id"
              ]
            },
            "in": "query",
            "name": "identity_type",
            "required": true,
            "description": "What kind of address this is. \"phone\" is stored in international format, \"email\" is lowercased, and \"whatsapp_user_id\" is the WhatsApp id of a contact whose phone number is hidden."
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 320
            },
            "in": "query",
            "name": "identity_value",
            "required": true,
            "description": "The address itself — e.g. \"+962790007001\" or \"lead@example.com\"."
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckOutboundBlocklistOutputDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/email": {
      "post": {
        "operationId": "sendEmail",
        "summary": "Send emails",
        "description": "\nSend emails to multiple contacts, possibly with a time delay.\n\nTo send emails using the API, you must first verify the domain you want to\nsend emails from. You can add and verify custom domains in the settings.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SendEmailInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response"
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/email/domains": {
      "put": {
        "operationId": "putCustomDomain",
        "summary": "Add or update a custom domain for email sending",
        "description": "\nAdd or update a custom domain for sending emails. After adding a domain, you'll need to verify it by adding the provided DNS records.\nNew domains default to EU (Ireland). Choose eu-west-1 or us-east-1 at creation; the sending region cannot be changed afterward. Adding an existing domain returns its existing configuration.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutCustomDomainInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PutCustomDomainOutput"
                }
              }
            }
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomDomainErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomDomainErrorDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomDomainErrorDto"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listCustomDomains",
        "summary": "List all custom domains",
        "description": "\nList all custom domains for your organization, including their verification status and DNS records.\n",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetCustomDomainsOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/email/domains/{domainName}/verify": {
      "patch": {
        "operationId": "startVerifyingCustomDomain",
        "summary": "Start verification process for a custom domain",
        "description": "\nStart the verification process for a custom domain. Make sure you've added the DNS records before starting verification.\n",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "domainName",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomDomainMutationOutputDto"
                }
              }
            }
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomDomainErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomDomainErrorDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomDomainErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/email/domains/{domainName}": {
      "delete": {
        "operationId": "deleteCustomDomain",
        "summary": "Delete a custom domain",
        "description": "\nDelete a custom domain from your organization. This will prevent you from sending emails from this domain.\n",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "domainName",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomDomainMutationOutputDto"
                }
              }
            }
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomDomainErrorDto"
                }
              }
            }
          },
          "404": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomDomainErrorDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomDomainErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/email/channels": {
      "get": {
        "operationId": "listEmailChannels",
        "summary": "List email channels",
        "description": "List the inboxes connected to your organization, with the HTML template that wraps every reply sent from each. `sender_signature` is a legacy read-only signature, appended only while an inbox uses the default template; setting a custom template stops it.",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListEmailChannelsOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/email/channels/{emailChannelId}": {
      "patch": {
        "operationId": "updateEmailChannelTemplate",
        "summary": "Update an email channel's template",
        "description": "Set the HTML template of one inbox; null or an empty string resets it to the built-in default. Applies to every reply sent from the inbox from then on.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdatePublicEmailChannelTemplateDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "emailChannelId",
            "required": true,
            "description": "Email channel ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicEmailChannelDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/email-templates": {
      "get": {
        "operationId": "listEmailTemplates",
        "summary": "List email templates",
        "description": "List all email templates for your organization. Templates support {{variable}} placeholders in subject and body.",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListEmailTemplatesOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createEmailTemplate",
        "summary": "Create an email template",
        "description": "Create a new email template. Use {{variable}} syntax in subject and body; variables are extracted into a JSON schema on save.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateEmailTemplatePublicInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailTemplateDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/email-templates/{id}": {
      "get": {
        "operationId": "getEmailTemplate",
        "summary": "Get an email template",
        "description": "Get a single email template by ID.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "Email template ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailTemplateDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "updateEmailTemplate",
        "summary": "Update an email template",
        "description": "Update an existing email template. Re-extracts {{variable}} placeholders from subject and body.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateEmailTemplatePublicInput"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "Email template ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailTemplateDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteEmailTemplate",
        "summary": "Delete an email template",
        "description": "Permanently delete an email template. Outbound emails already sent keep their stored content.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "Email template ID"
          }
        ],
        "responses": {
          "204": {
            "description": "Default Response"
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/email-templates/{id}/activity": {
      "get": {
        "operationId": "getEmailTemplateActivity",
        "summary": "List sends for an email template",
        "description": "List outbound emails sent using this template, newest first. Useful for auditing template usage.",
        "parameters": [
          {
            "schema": {
              "default": 0,
              "type": "number",
              "minimum": 0
            },
            "in": "query",
            "name": "offset",
            "required": false
          },
          {
            "schema": {
              "default": 20,
              "type": "number",
              "minimum": 1,
              "maximum": 100
            },
            "in": "query",
            "name": "limit",
            "required": false
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "Email template ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailTemplateActivityResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/macros": {
      "get": {
        "operationId": "listMacros",
        "summary": "List macros",
        "description": "List all saved-reply macros for the organization.",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListMacrosOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createMacro",
        "summary": "Create a macro",
        "description": "Create a new saved-reply macro. Use {{variable}} syntax in content to reference system or custom variables. Attachments are dashboard-authored and cannot be set via the public API.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateMacroInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SavedReplyDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/macros/variables": {
      "get": {
        "operationId": "listMacroVariables",
        "summary": "List macro variables",
        "description": "List the variables available for use in macro content: built-in `enums` (system variables like {{contact.full_name}}) and the organization's `custom` variables. Reference them in macro content with {{variable}} syntax. Custom variables are authored and managed in the OpenCX dashboard — this endpoint is read-only.",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SavedReplyVariablesResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/macros/suggestion-insights": {
      "get": {
        "operationId": "listMacroSuggestionInsights",
        "summary": "List macro suggestion insights",
        "description": "How each org-wide macro is doing as a suggestion over the last 30 days: how often it was shown, used from the suggestions, or reached for by search instead, and the state it is in (`learning`, `steady`, `proven`, `muted`, or `off` when the macro is excluded or suggestions are off). Pass `include_weekly=true` for 12 weekly counts per macro. Macros excluded from suggestions with no activity in the last 30 days are left out.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            },
            "in": "query",
            "name": "include_weekly",
            "required": false
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MacroSuggestionInsightsListDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/macros/settings": {
      "get": {
        "operationId": "getMacroSettings",
        "summary": "Get macro settings",
        "description": "The macro settings: the languages every org-wide macro is translated into (`translation_languages`, empty when translation is off), the most that can be chosen, the language codes that can be chosen, and whether suggested macros are on for the workspace.",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MacroSettingsDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "updateMacroSettings",
        "summary": "Update macro settings",
        "description": "Choose the languages every org-wide macro is translated into. Choosing a language translates every org-wide macro into it; languages that are already chosen are not translated again. Translations are read-only generated copies: edit the macro and they refresh. Variables are never translated. Whether suggested macros are on for the workspace is read-only here (`suggestions_enabled` in the response); it is changed in Settings → Workspace. Returns the new settings.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateMacroSettingsDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MacroSettingsDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/macros/{id}": {
      "get": {
        "operationId": "getMacro",
        "summary": "Get a macro",
        "description": "Get a single saved-reply macro by ID.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "Macro ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SavedReplyDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateMacro",
        "summary": "Update a macro",
        "description": "Partially update a saved-reply macro. Attachments are dashboard-authored and cannot be changed via the public API; text-only updates leave attachments and options untouched.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateMacroInput"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "Macro ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SavedReplyDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteMacro",
        "summary": "Delete a macro",
        "description": "Permanently delete a saved-reply macro.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "Macro ID"
          }
        ],
        "responses": {
          "204": {
            "description": "Default Response"
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/macros/{id}/suggestion-insights": {
      "get": {
        "operationId": "getMacroSuggestionInsights",
        "summary": "Get macro suggestion insights",
        "description": "How one org-wide macro is doing as a suggestion over the last 30 days, with 12 weekly counts: shown, used from the suggestions, reached for by search instead, hit rate, the bar it has to clear, and its state (`learning`, `steady`, `proven`, `muted`, or `off`).",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "Macro ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MacroSuggestionInsightsDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/macros/{id}/translations": {
      "get": {
        "operationId": "getMacroTranslations",
        "summary": "Get macro translations",
        "description": "One org-wide macro's translation into each selected language: its `status` (`ready`, `pending` while it is being translated or after the macro changed, or `failed`) and the translated `title`, `content` and option labels, which are empty until the translation is ready. `source_language` is the language the macro itself is written in, which gets no translation. Translations are read-only generated copies: edit the macro and they refresh. Personal macros are not included.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "Macro ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MacroTranslationsDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/macros/{id}/translations/retranslate": {
      "post": {
        "operationId": "retranslateMacro",
        "summary": "Retranslate a macro",
        "description": "Translate one org-wide macro again into the listed languages, or into every selected language when `languages` is left out (failed ones included). Send `{}` to redo every selected language. Returns the languages now waiting. Fails with 400 when no translation languages are selected (see `updateMacroSettings`), when a listed language is not one of them, or when the macro has no translation in a listed language (such as its own).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RetranslateMacroDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "Macro ID"
          }
        ],
        "responses": {
          "202": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RetranslateMacroResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/skills": {
      "get": {
        "operationId": "listSkills",
        "summary": "List skills",
        "description": "List every routing skill defined for the organization, newest first. Skills power skills-based routing: a session carries required skills (set by the \"Assign Skills to Ticket\" workflow action) and, when a team-assign action runs with skill-based routing enabled, only agents holding every required skill are eligible. Session skills are not writable through the API.",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListSkillsOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createSkill",
        "summary": "Create a skill",
        "description": "Create a routing skill. Names are unique per organization, case-insensitively (400 on conflict). The description is what workflow steps see in the `{{routingSkills}}` variable when an AI step decides which skills a session needs, so write it as the condition under which the skill applies.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSkillDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SkillDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/skills/{skill_id}": {
      "get": {
        "operationId": "getSkill",
        "summary": "Get a skill",
        "description": "Get a single routing skill by ID.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "skill_id",
            "required": true,
            "description": "Skill ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SkillDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateSkill",
        "summary": "Update a skill",
        "description": "Rename a routing skill and/or change its description. Renaming is safe: agents and sessions reference skills by ID. 400 if the new name already exists (case-insensitive).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSkillDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "skill_id",
            "required": true,
            "description": "Skill ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SkillDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteSkill",
        "summary": "Delete a skill",
        "description": "Delete a routing skill. Agents and sessions that referenced it simply stop requiring / holding it — references are dropped at read time.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "skill_id",
            "required": true,
            "description": "Skill ID"
          }
        ],
        "responses": {
          "204": {
            "description": "Default Response"
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/skills/users/{user_id}": {
      "get": {
        "operationId": "getUserSkills",
        "summary": "Get an agent's skills",
        "description": "List the routing skills an organization member holds. Skills deleted after assignment are omitted. 404 if the user is not a member of the organization.",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            },
            "in": "path",
            "name": "user_id",
            "required": true,
            "description": "Organization user ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetUserSkillsOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "setUserSkills",
        "summary": "Replace an agent's skills",
        "description": "Replace the full set of routing skills an organization member holds (skills not in `skill_ids` are removed). 400 if any ID is not a skill of this organization; 404 if the user is not a member. Returns the resolved skills now assigned.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateUserSkillsDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            },
            "in": "path",
            "name": "user_id",
            "required": true,
            "description": "Organization user ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SetUserSkillsOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/handoff-analytics/events": {
      "get": {
        "operationId": "listHandoffEvents",
        "summary": "List handoff events",
        "description": "Returns a paginated list of individual AI-to-human handoff events, newest first. Each event includes the AI-written summary and explanation of why it handed off, the handoff reasons, sentiment, and the session ID. Filter by reason (e.g. insufficient_tools) and date range to analyze recurring gaps.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "cursor",
            "required": false,
            "description": "Pagination cursor from a previous response"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "ai_implied_handoff",
                "based_on_instructions",
                "feature_limit_reached__ai_resolutions",
                "feature_limit_reached__ai_voice_minutes",
                "instructions_not_clear",
                "insufficient_knowledge",
                "insufficient_tools",
                "prohibited_topic",
                "user_requested_human_assistance"
              ]
            },
            "in": "query",
            "name": "reason",
            "required": false,
            "description": "Only return handoffs that include this reason"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "start_date",
            "required": false,
            "description": "Start date in ISO 8601 format (defaults to 30 days ago)"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "end_date",
            "required": false,
            "description": "End date in ISO 8601 format (defaults to now)"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListHandoffEventsOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/handoff-analytics": {
      "get": {
        "operationId": "getHandoffAnalytics",
        "summary": "Get handoff analytics",
        "description": "Get a comprehensive overview of AI-to-human handoff events for a date range, including reason breakdowns, sentiment analysis, trends, and referenced resources.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "start_date",
            "required": false,
            "description": "Start date in ISO 8601 format (defaults to 30 days ago)"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "end_date",
            "required": false,
            "description": "End date in ISO 8601 format (defaults to now)"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "instruction_id",
            "required": false,
            "description": "Filter to only handoffs referencing this instruction ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HandoffAnalyticsPublicResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/impact-report": {
      "get": {
        "operationId": "getImpactReport",
        "summary": "Get impact report",
        "description": "Get the AI automation rate and resolution breakdown. Returns total resolved, assumed resolved, handed off, and in-progress sessions along with the computed automation rate percentage, plus per-day resolution (`resolutions_daily`), per-day automation rate (`automation_rate_daily`), and sentiment (`sentiments_daily`) counts and the resolution totals (`resolution_totals`) and sentiment totals (`sentiment_totals`) for charting.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "start_date",
            "required": false,
            "description": "Start date in ISO 8601 format; a date-only value starts at 00:00 UTC (defaults to 30 days before the end)"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "end_date",
            "required": false,
            "description": "End date in ISO 8601 format; a date-only value covers the whole UTC day (defaults to now)"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImpactReportResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/impact-report/sankey": {
      "get": {
        "operationId": "getConversationSankey",
        "summary": "Get conversation-flow Sankey",
        "description": "Get a Sankey breakdown of how conversations flow through the chosen dimensions. Pass an ordered, comma-separated list of dimension keys (e.g. \"replied_by,outcome\" or \"integration_source,channel\"). Returns nodes and links describing the flow.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "dimensions",
            "required": true,
            "description": "Ordered dimensions, 1–6, built left→right. Either a comma-separated key list (\"replied_by,outcome\") or a JSON array of {dimension, customDataKey} to give each custom-data column its own jsonb key, e.g. [{\"dimension\":\"contact_custom_data\",\"customDataKey\":\"tier\"},{\"dimension\":\"session_custom_data\",\"customDataKey\":\"plan\"}]."
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "custom_data_key",
            "required": false,
            "description": "Fallback jsonb key for custom-data dimensions given via the CSV form (or when a JSON dimension omits its own customDataKey). Ignored where a dimension carries its own key."
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "start_date",
            "required": false,
            "description": "Start date in ISO 8601 format (defaults to 30 days ago)"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "end_date",
            "required": false,
            "description": "End date in ISO 8601 format; a date-only value covers the whole UTC day (defaults to now)"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SankeyReportResDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/impact-report/sankey/tickets": {
      "get": {
        "operationId": "getConversationSankeyTickets",
        "summary": "List the tickets behind a Sankey node/link",
        "description": "Drill down into a conversation-flow Sankey: list the actual chat sessions (tickets) that flow through a clicked node or link. Pass the SAME dimensions/date/custom_data_key as getConversationSankey, plus a JSON-encoded `path` — one {layerIndex, bucket} constraint for a clicked node, two for a clicked link. Paginated via limit/offset. Chain into investigate_session on a returned ticket id to diagnose the \"why\".",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "dimensions",
            "required": true,
            "description": "Ordered dimensions, 1–6, built left→right. Either a comma-separated key list (\"replied_by,outcome\") or a JSON array of {dimension, customDataKey} to give each custom-data column its own jsonb key, e.g. [{\"dimension\":\"contact_custom_data\",\"customDataKey\":\"tier\"},{\"dimension\":\"session_custom_data\",\"customDataKey\":\"plan\"}]."
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "path",
            "required": true,
            "description": "JSON-encoded array of {layerIndex, bucket} constraints identifying the clicked target: 1 constraint = a clicked node, 2 = a clicked link. bucket may be an \"Other (N)\" label."
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "custom_data_key",
            "required": false,
            "description": "Fallback jsonb key for custom-data dimensions given via the CSV form (or when a JSON dimension omits its own customDataKey). Ignored where a dimension carries its own key."
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "start_date",
            "required": false,
            "description": "Start date in ISO 8601 format (defaults to 30 days ago)"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "end_date",
            "required": false,
            "description": "End date in ISO 8601 format; a date-only value covers the whole UTC day (defaults to now)"
          },
          {
            "schema": {
              "default": 20,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "in": "query",
            "name": "limit",
            "required": false
          },
          {
            "schema": {
              "default": 0,
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "in": "query",
            "name": "offset",
            "required": false
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SankeyTicketsResDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/impact-report/sankey/dimensions": {
      "get": {
        "operationId": "getConversationSankeyDimensions",
        "summary": "List conversation-flow Sankey dimensions",
        "description": "List the dimension keys a conversation-flow Sankey can be sliced by, plus the org's observed custom-data keys (with labels) for contact_custom_data and session_custom_data. Call this before getConversationSankey to choose valid dimensions and the custom_data_key.",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SankeyDimensionCatalogResDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/office-hours": {
      "get": {
        "operationId": "listOfficeHours",
        "summary": "List office hours schedules",
        "description": "List all office hours schedules for your organization. Office hours define when your support team is available. The AI uses this to set expectations and route conversations appropriately outside business hours.",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListOfficeHoursOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createOfficeHours",
        "summary": "Create an office hours schedule",
        "description": "Create a new office hours schedule with time shifts. Each shift defines a day (or day range) and start/end times. Example: Monday-Friday 9am-5pm EST would be one shift with day_of_week \"monday_to_friday\", start_time \"09:00:00\", end_time \"17:00:00\", and iana_timezone \"America/New_York\".",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateOfficeHoursPublicDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OfficeHoursPublicResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/office-hours/default": {
      "get": {
        "operationId": "getDefaultOfficeHours",
        "summary": "Get default office hours",
        "description": "Get the organization-wide default office hours schedule. This is the fallback schedule used when a conversation is not assigned to a team with its own custom office hours. If no default has been configured yet, returns America/New_York with an empty shifts list (treated as 24/7).",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultOfficeHoursResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "updateDefaultOfficeHours",
        "summary": "Update default office hours",
        "description": "Set or replace the organization-wide default office hours. The shifts array replaces all existing default shifts — include every shift you want to keep. Example: Monday-Friday 9am-5pm EST would be one shift with day_of_week \"monday_to_friday\", start_time \"09:00:00\", end_time \"17:00:00\", and iana_timezone \"America/New_York\".",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DefaultOfficeHoursInputDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefaultOfficeHoursResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/office-hours/{id}": {
      "get": {
        "operationId": "getOfficeHours",
        "summary": "Get an office hours schedule",
        "description": "Get a specific office hours schedule by ID, including all its shifts.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OfficeHoursPublicResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "updateOfficeHours",
        "summary": "Update an office hours schedule",
        "description": "Update an office hours schedule. The shifts array replaces all existing shifts — include all shifts you want to keep.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateOfficeHoursPublicDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteOfficeHours",
        "summary": "Delete an office hours schedule",
        "description": "Delete an office hours schedule and all its shifts. This action cannot be undone.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response"
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/tags": {
      "get": {
        "operationId": "listTags",
        "summary": "List tags",
        "description": "List tags for your organization. Tags categorize chat sessions (e.g. \"billing\", \"refund\", \"feature-request\"). The AI can auto-tag sessions based on these. Optionally filter by `search` (case-insensitive substring of tag name or description), `category_id`, and `limit`. With no params, returns all tags ordered by name.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "search",
            "required": false,
            "description": "Case-insensitive substring match on tag name or description"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "query",
            "name": "category_id",
            "required": false,
            "description": "Only tags assigned to this category"
          },
          {
            "schema": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            },
            "in": "query",
            "name": "limit",
            "required": false,
            "description": "Max tags to return (clamped to 200)"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListTagsOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "upsertTag",
        "summary": "Create or update a tag",
        "description": "Create a new tag or update an existing one. If a tag with this name already exists, it will be updated. Use exclude_from_auto_tagging to prevent the AI from auto-applying this tag.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpsertTagInputDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response"
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/tags/in-use": {
      "get": {
        "operationId": "listTagsInUse",
        "summary": "List tags in use",
        "description": "List all distinct tag names that are actually applied to sessions. Useful to see which tags are being used vs. unused.",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TagsInUseOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/tags/{tag_name}": {
      "delete": {
        "operationId": "deleteTag",
        "summary": "Delete a tag",
        "description": "Remove a tag from your organization. Sessions that already have this tag will keep it.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "tag_name",
            "required": true,
            "description": "The tag name to remove"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response"
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/tags/auto-tagging": {
      "get": {
        "operationId": "getAutoTaggingStatus",
        "summary": "Get auto-tagging status",
        "description": "Check whether AI auto-tagging is enabled for your organization. When enabled, the AI automatically applies relevant tags to chat sessions based on conversation content.",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutoTaggingStatusOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "updateAutoTaggingStatus",
        "summary": "Enable or disable auto-tagging",
        "description": "Turn AI auto-tagging on or off. When enabled, the AI will automatically apply relevant tags from your taxonomy to chat sessions based on conversation content.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateAutoTaggingInputDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpdateAutoTaggingOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/tags/categories": {
      "get": {
        "operationId": "listTagCategories",
        "summary": "List tag categories",
        "description": "List tag categories for your organization. Categories group related tags (e.g. \"Billing\", \"Product Area\") so the AI can tag scalably across large taxonomies. Optionally filter by `search` (case-insensitive substring of category name or description) and `limit`. With no params, returns all categories ordered by name.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "search",
            "required": false,
            "description": "Case-insensitive substring match on category name or description"
          },
          {
            "schema": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            },
            "in": "query",
            "name": "limit",
            "required": false,
            "description": "Max categories to return (clamped to 200)"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListTagCategoriesOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createTagCategory",
        "summary": "Create a tag category",
        "description": "Create a new tag category. Tags can then be assigned to it via upsertTag using the returned category id.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateTagCategoryInputDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TagCategoryPublicResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/tags/categories/{id}": {
      "put": {
        "operationId": "updateTagCategory",
        "summary": "Update a tag category",
        "description": "Update the name and/or description of an existing tag category.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateTagCategoryInputDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "The category id to update"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TagCategoryPublicResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteTagCategory",
        "summary": "Delete a tag category",
        "description": "Delete a tag category. Tags previously assigned to it become uncategorized.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "The category id to delete"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response"
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/custom-statuses": {
      "get": {
        "operationId": "listCustomStatuses",
        "summary": "List custom statuses",
        "description": "List every custom session status defined for your organization. A custom status refines one of the built-in statuses (open, closed_resolved, closed_unresolved) with an agent-facing name and optional customer-facing label, color, and icon. A session carries at most one custom status in its `sub_status_id`; use this list to resolve that id to a name.",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListCustomStatusesOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createCustomStatus",
        "summary": "Create a custom status",
        "description": "Create a custom session status under one of the built-in statuses. Names are unique per organization. Once created, apply it to a session with `PUT /chat/sessions/{session_id}/sub-status`.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCustomStatusDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomSessionStatusDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/custom-statuses/{id}": {
      "get": {
        "operationId": "getCustomStatus",
        "summary": "Get a custom status",
        "description": "Fetch one custom session status by id.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "The custom status id"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomSessionStatusDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateCustomStatus",
        "summary": "Update a custom status",
        "description": "Update any subset of a custom status. Omitted fields are left unchanged; the nullable display fields accept null to clear them. Sessions already carrying this status keep it.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateCustomStatusPublicDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "The custom status id"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomSessionStatusDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteCustomStatus",
        "summary": "Delete a custom status",
        "description": "Delete a custom status. Sessions that carried it fall back to their built-in status (`sub_status_id` becomes null); their timeline history keeps the id.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "The custom status id"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteCustomStatusOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/inbox-views": {
      "get": {
        "operationId": "listInboxViews",
        "summary": "List saved inbox views",
        "description": "List the saved inbox views the calling user can see: their own, the ones shared with them or their teams, and the organization-wide ones. A saved view is a named session filter set that agents pick from the inbox sidebar.",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListInboxViewsOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createInboxView",
        "summary": "Create a saved inbox view",
        "description": "Create a named, filtered view of the inbox and share it with the organization, named teams, or named users. The view is evaluated fresh every time it is opened, so `$current_user` assignees and `date.preset` windows stay dynamic. Leave both share lists empty to share the view with the whole organization. Name users and/or teams to restrict it to them, or pass only your own user id to keep it private. Sharing requires the `sessions-shared-views:write` permission — without it a created view is locked to its creator and the share lists on an update are ignored.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateInboxViewDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InboxViewDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/inbox-views/{id}": {
      "patch": {
        "operationId": "updateInboxView",
        "summary": "Update a saved inbox view",
        "description": "Update any subset of a saved view. Omitted fields are left unchanged; sending `filters` replaces the saved query outright. Only the view's creator, or someone with the `sessions-shared-views:write` permission editing a shared view, may update it (see `can_edit`).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateInboxViewDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "The inbox view id"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InboxViewDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteInboxView",
        "summary": "Delete a saved inbox view",
        "description": "Delete a saved view. It disappears from the sidebar for everyone it was shared with; the sessions it matched are untouched. Requires the same permission as updating it (see `can_delete`).",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "The inbox view id"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GenericResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/call-flows/assets": {
      "get": {
        "operationId": "listCallFlowAssets",
        "summary": "List WAV recordings for call flows",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                      },
                      "name": {
                        "type": "string"
                      },
                      "sample_rate": {
                        "type": "number"
                      },
                      "channels": {
                        "type": "number"
                      },
                      "duration_seconds": {
                        "type": "number"
                      },
                      "created_at": {
                        "type": "string",
                        "format": "date-time"
                      }
                    },
                    "required": [
                      "id",
                      "name",
                      "sample_rate",
                      "channels",
                      "duration_seconds",
                      "created_at"
                    ],
                    "additionalProperties": false
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "uploadCallFlowAsset",
        "summary": "Upload an immutable WAV recording",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "wavBase64": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 28000000
                  }
                },
                "required": [
                  "name",
                  "wavBase64"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                    },
                    "name": {
                      "type": "string"
                    },
                    "sample_rate": {
                      "type": "number"
                    },
                    "channels": {
                      "type": "number"
                    },
                    "duration_seconds": {
                      "type": "number"
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "sample_rate",
                    "channels",
                    "duration_seconds",
                    "created_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/call-flows/binding": {
      "put": {
        "operationId": "setCallFlowBinding",
        "summary": "Assign an active call flow to a phone number",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "phoneId": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  "workflowId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "phoneId",
                  "workflowId"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/workflows/definitions": {
      "get": {
        "operationId": "listWorkflowDefinitions",
        "summary": "[Beta] List available action and trigger types",
        "tags": [
          "Workflows (Beta)"
        ],
        "description": "List all available workflow action types and trigger types with their metadata. Use this to discover what actions and triggers are available when building workflows programmatically.",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowDefinitionsPublicDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/workflows/validate": {
      "post": {
        "operationId": "validateWorkflow",
        "summary": "[Beta] Validate a workflow definition",
        "tags": [
          "Workflows (Beta)"
        ],
        "description": "Validate workflow blocks without creating a workflow. Runs both the structural check and the deep semantic validation the dashboard editor runs on Save (action inputs against each action's input schema, trigger configuration against the trigger's configuration_def). Returns validation issues and the list of action types used. Use this before creating or updating a workflow to catch errors early.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ValidateWorkflowPublicInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidateWorkflowPublicOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/workflows": {
      "get": {
        "operationId": "listWorkflows",
        "summary": "[Beta] List workflows",
        "tags": [
          "Workflows (Beta)"
        ],
        "description": "List all workflows in your organization (latest version of each). Workflows automate multi-step processes triggered by events, schedules, webhooks, or manual action.",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListWorkflowsOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createWorkflow",
        "summary": "[Beta] Create a workflow",
        "tags": [
          "Workflows (Beta)"
        ],
        "description": "Create a new workflow. The workflow is created as an inactive draft (version 1). Use the activate endpoint to make it live. Use GET /workflows/definitions to discover available action and trigger types. Rejects definitions that fail deep validation (missing required action inputs or trigger configuration) with a 400 carrying structured issues.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateWorkflowPublicInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowDetailPublicResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowValidationErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/workflows/{workflow_id}": {
      "get": {
        "operationId": "getWorkflow",
        "summary": "[Beta] Get a workflow",
        "tags": [
          "Workflows (Beta)"
        ],
        "description": "Get a specific workflow by its UUID, including its blocks, trigger configuration, and active status. In companion context (acting user), the user’s unsaved draft — when one exists — is returned as the working copy in place of the latest saved version.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "workflow_id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowDetailPublicResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateWorkflow",
        "summary": "[Beta] Update a workflow (creates a new version)",
        "tags": [
          "Workflows (Beta)"
        ],
        "description": "Update a workflow by creating a new version. The new version is created as an inactive draft. Only the provided fields are changed; omitted fields carry over from the current version. Use the activate endpoint to make the new version live. When blocks or trigger fields are provided, the resulting definition must pass deep validation — failures return a 400 with structured issues.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateWorkflowPublicInput"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "workflow_id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowDetailPublicResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowValidationErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteWorkflow",
        "summary": "[Beta] Delete a workflow",
        "tags": [
          "Workflows (Beta)"
        ],
        "description": "Soft-delete a workflow and all its versions. Active versions are deactivated first. This cannot be undone.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "workflow_id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteWorkflowOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/workflows/{workflow_id}/draft": {
      "patch": {
        "operationId": "updateWorkflowDraftAware",
        "summary": "[Beta] Update a workflow draft in place when possible",
        "tags": [
          "Workflows (Beta)"
        ],
        "description": "Updates the latest workflow version in place when it is a pristine draft (inactive and without recorded non-test runs). If the latest version is active or has real run history, a new inactive draft version is created instead. In companion context (acting user), the edit applies on top of the user’s unsaved editor draft — snapshotting their work-in-progress into the version — and consumes that draft. The resulting definition must pass deep validation when it changes; failures return a 400 with structured issues. Only versions can be activated.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateWorkflowPublicInput"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "workflow_id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowDetailPublicResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowValidationErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/workflows/{workflow_id}/activate": {
      "post": {
        "operationId": "activateWorkflow",
        "summary": "[Beta] Activate a workflow",
        "tags": [
          "Workflows (Beta)"
        ],
        "description": "Activate the latest version of a workflow. Any previously active version is deactivated. The workflow will start responding to its configured trigger.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "workflow_id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ActivateWorkflowOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/workflows/{workflow_id}/deactivate": {
      "post": {
        "operationId": "deactivateWorkflow",
        "summary": "[Beta] Deactivate a workflow",
        "tags": [
          "Workflows (Beta)"
        ],
        "description": "Deactivate the currently active version of a workflow. The workflow will stop responding to its trigger.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "workflow_id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeactivateWorkflowOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/workflows/{workflow_id}/trigger": {
      "post": {
        "operationId": "triggerWorkflow",
        "summary": "[Beta] Trigger a workflow",
        "tags": [
          "Workflows (Beta)"
        ],
        "description": "Manually trigger a workflow. The workflow must have a \"manual-trigger\" trigger type and must be active. The workflow runs asynchronously in the background.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "workflow_id",
            "required": true,
            "description": "The workflow UUID to trigger"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response"
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/workflows/{workflow_id}/invoke": {
      "post": {
        "operationId": "invokeWorkflow",
        "summary": "[Beta] Invoke a workflow",
        "tags": [
          "Workflows (Beta)"
        ],
        "description": "Run a workflow the same way the AI agent runs one during a conversation. Handles the on-demand trigger types the agent can invoke — ai-trigger, manual-ticket-trigger, and manual-trigger — and rejects event-only workflows. `input` is the payload: the ai payload for ai-trigger, the form data for manual-ticket-trigger (manual-trigger takes none). With `context.sessionId`, the workflow runs with the same in-session ticket context the agent has (required for manual-ticket-trigger). This exposes, to a caller embedded in a conversation, the same workflows the agent can trigger in that session. Returns the run id, plus the terminal output when the workflow runs synchronously.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InvokeWorkflowDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "workflow_id",
            "required": true,
            "description": "The workflow UUID to invoke"
          }
        ],
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvokeWorkflowResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/workflows/{workflow_id}/runs": {
      "get": {
        "operationId": "listWorkflowRuns",
        "summary": "[Beta] List workflow runs",
        "tags": [
          "Workflows (Beta)"
        ],
        "description": "List execution runs for a workflow with filtering and pagination. Filter by status (completed, failed, in_progress, canceled, idle), trigger cause (manual, automatic, scheduled), and search by keyword.",
        "parameters": [
          {
            "schema": {
              "default": 1,
              "type": "number"
            },
            "in": "query",
            "name": "page",
            "required": false,
            "description": "Page number (1-based)"
          },
          {
            "schema": {
              "default": 20,
              "type": "number"
            },
            "in": "query",
            "name": "limit",
            "required": false,
            "description": "Results per page (max 50)"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "status",
            "required": false,
            "description": "Comma-separated statuses: completed, failed, in_progress, canceled, idle"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "trigger_cause",
            "required": false,
            "description": "Comma-separated causes: manual, automatic, scheduled"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "workflow_id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListWorkflowRunsOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/workflows/{workflow_id}/runs/{run_id}": {
      "get": {
        "operationId": "getWorkflowRun",
        "summary": "[Beta] Get a workflow run",
        "tags": [
          "Workflows (Beta)"
        ],
        "description": "Get details of a specific workflow run, including status, duration, trigger info, and timestamps.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "workflow_id",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "run_id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRunPublicResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/workflows/{workflow_id}/runs/{run_id}/run-steps": {
      "get": {
        "operationId": "getWorkflowRunSteps",
        "summary": "[Beta] Get step-level results for a workflow run",
        "tags": [
          "Workflows (Beta)"
        ],
        "description": "Return per-step inputs, outputs, status, and timing for a single workflow run, in execution order. Use this after listWorkflowRuns / getWorkflowRun to drill into exactly which step failed and what it saw.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "workflow_id",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "run_id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetWorkflowRunStepsOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/workflows/{workflow_id}/runs/{run_id}/logs": {
      "get": {
        "operationId": "getWorkflowRunLogs",
        "summary": "[Beta] Get chronological log entries for a workflow run",
        "tags": [
          "Workflows (Beta)"
        ],
        "description": "Return per-step log entries for a workflow run, including block / branch context. Use this when run-steps detail is not enough — typically when branching or scope resolution went sideways.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "workflow_id",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "run_id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetWorkflowRunLogsOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/workflows/{workflow_id}/runs/{run_id}/rerun": {
      "post": {
        "operationId": "rerunWorkflowRun",
        "summary": "[Beta] Re-fire a failed workflow run with the same payload",
        "tags": [
          "Workflows (Beta)"
        ],
        "description": "Create a new workflow run using the same trigger payload as the original. Only runs in FAILED status can be rerun. Replays against the same workflow version the original run executed — useful for reproducing flakes or post-fix integration retests, not for validating a NEW version (use test_workflow + activate_workflow for that).",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "workflow_id",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "run_id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RerunWorkflowRunPublicOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/workflows/{workflow_id}/test": {
      "post": {
        "operationId": "testWorkflow",
        "summary": "[Beta] Dry-run a workflow against a synthetic payload",
        "tags": [
          "Workflows (Beta)"
        ],
        "description": "Run the latest version of a workflow once against a synthetic trigger payload, isolated as a test run. Call this after validateWorkflow and before activateWorkflow to confirm the workflow behaves as expected. Returns the new run id — feed it into getWorkflowRun / getWorkflowRunSteps to inspect the result. WARNING: \"test\" means synthetic payload, not \"no side effects\". Actions that send webhooks, post Slack messages, write to integrations, or mutate tickets WILL fire for real. Scope to a test entity or disable destination integrations before calling on a workflow with destructive steps.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TestWorkflowPublicInput"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "workflow_id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TestWorkflowPublicOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/workflows/{workflow_id}/clone": {
      "post": {
        "operationId": "cloneWorkflow",
        "summary": "[Beta] Clone a workflow into a new inactive draft",
        "tags": [
          "Workflows (Beta)"
        ],
        "description": "Create a new workflow whose blocks, trigger, and editor state are copied from the latest version of the source workflow. The clone starts inactive — call activateWorkflow when ready. Use this for templating (\"like X but for Y\").",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "workflow_id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowDetailPublicResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/org": {
      "get": {
        "operationId": "getOrg",
        "summary": "Get current organization",
        "tags": [
          "Organization"
        ],
        "description": "Retrieve the organization associated with the current API key.",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganizationDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateOrg",
        "summary": "Update current organization",
        "tags": [
          "Organization"
        ],
        "description": "Update settings of the organization associated with the current API key.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateOrganizationInputDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganizationDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/session-sidebar": {
      "get": {
        "operationId": "getSessionSidebar",
        "summary": "Get the session sidebar layout",
        "tags": [
          "Session sidebar"
        ],
        "description": "The workspace-wide arrangement of the cards and widgets in the session sidebar (the right side of an open session).",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionSidebarDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "updateSessionSidebar",
        "summary": "Update the session sidebar layout",
        "tags": [
          "Session sidebar"
        ],
        "description": "Reorder, hide or show cards and widgets in the session sidebar for the whole workspace. Partial update: omit a field to leave it unchanged. Returns the new layout.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSessionSidebarDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionSidebarDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/phone/voices": {
      "get": {
        "operationId": "listVoices",
        "summary": "List available voices",
        "description": "List the curated voices available for AI phone agents. Supports filtering by language, gender, accent, use_case, and free-text search. Use limit/offset for pagination. Use the voice_id when creating or updating a phone agent.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "language",
            "required": false,
            "description": "Filter by language (e.g. \"en\", \"ar\", \"nl\"). A base code also matches its regional variants (\"ar\" returns \"ar-SA\" and \"ar-EG\" voices); a regional code matches only itself."
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "gender",
            "required": false,
            "description": "Filter by gender (e.g. \"male\", \"female\")"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "accent",
            "required": false,
            "description": "Filter by accent (e.g. \"american\", \"british\")"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "use_case",
            "required": false,
            "description": "Filter by use case (e.g. \"conversational\", \"narrative_story\")"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "search",
            "required": false,
            "description": "Case-insensitive name search"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "in": "query",
            "name": "limit",
            "required": false,
            "description": "Max results (default: all)"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "in": "query",
            "name": "offset",
            "required": false,
            "description": "Skip N results (default: 0)"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListVoicesOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/phone": {
      "post": {
        "operationId": "createPhoneAgent",
        "summary": "Create an AI phone agent",
        "description": "Create an AI phone agent powered by the latest voice model. Use GET /phone/voices to browse available voices. Only name is required — everything else has sensible defaults.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePhoneAgentPublicDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PhoneAgentDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listPhoneAgents",
        "summary": "List AI phone agents",
        "description": "List all AI phone agents in your organization with full details including name, type, model, voice, language, phone number, and configuration.",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListPhoneAgentsOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/phone/verified-phone-numbers": {
      "get": {
        "operationId": "listVerifiedPhoneNumbers",
        "summary": "List the organization's verified phone numbers",
        "description": "Every phone number verified for this organization, with its status and any assigned inbound agent. These are the values setPhoneAgentCallerNumber accepts as an outbound caller ID. Purchasing and verifying numbers is done in the dashboard.",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListVerifiedPhoneNumbersOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/phone/transfer-destinations": {
      "get": {
        "operationId": "listPhoneTransferDestinations",
        "summary": "List transfer destinations",
        "description": "List the transfer destinations configured for your organization (phone numbers, SIP endpoints, teams, or hang-up handbacks). Reference their IDs in transfer_destination_ids when creating or updating a phone agent; the agent can then transfer calls to them by name. Destinations are created and edited in the dashboard (Settings → SIP).",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListTransferDestinationsOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/phone/{phone_agent_id}/knowledge-sources": {
      "get": {
        "operationId": "getPhoneAgentKnowledgeSources",
        "summary": "Get phone agent knowledge-source tree",
        "description": "Returns the instructions and knowledge the agent can use, which of them are selected, and how the agent gets them during calls. An agent only uses what is selected.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "phone_agent_id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KnowledgeSourceTreeDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "updatePhoneAgentKnowledgeSources",
        "summary": "Update phone agent knowledge sources",
        "description": "Select the instructions and knowledge the agent can use. Nothing else reaches the agent: an empty list means none. New items inside a selected folder are included; new folders and items outside selected folders are not. When the selection fits, the agent loads it at the start of each call; otherwise it searches it during calls.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateKnowledgeSourcesDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "phone_agent_id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpdateKnowledgeSourcesResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/phone/{phone_agent_id}/knowledge-sources/items": {
      "get": {
        "operationId": "listPhoneAgentKnowledgeSourceItems",
        "summary": "List knowledge items in a phone agent source folder",
        "description": "Returns one page of public knowledge items for a canonical folder key.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 500
            },
            "in": "query",
            "name": "folderKey",
            "required": true
          },
          {
            "schema": {
              "default": 1,
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "in": "query",
            "name": "page",
            "required": false
          },
          {
            "schema": {
              "default": 20,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "in": "query",
            "name": "limit",
            "required": false
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "phone_agent_id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          },
                          "sourceUrl": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "selected": {
                            "type": "boolean"
                          },
                          "selectable": {
                            "type": "boolean",
                            "description": "Whether this source can be selected for a voice agent"
                          },
                          "unavailableReason": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "User-facing explanation when the source cannot be selected"
                          }
                        },
                        "required": [
                          "id",
                          "title",
                          "sourceUrl",
                          "selected",
                          "selectable",
                          "unavailableReason"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "number"
                        },
                        "limit": {
                          "type": "number"
                        },
                        "total": {
                          "type": "number"
                        },
                        "hasNextPage": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "page",
                        "limit",
                        "total",
                        "hasNextPage"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "items",
                    "pagination"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/phone/{phone_agent_id}/caller-number": {
      "put": {
        "operationId": "setPhoneAgentCallerNumber",
        "summary": "Attach or detach the outbound caller number of a phone agent",
        "description": "Set which of your verified phone numbers this agent presents as caller ID on outbound calls (including campaign voice steps) — or pass null to detach. The number must already be verified for your organization; purchasing and verifying numbers is done in the dashboard. The agent's SIP trunk assignment is not affected.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetPhoneAgentCallerNumberInput"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "phone_agent_id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SetPhoneAgentCallerNumberOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/phone/{phone_agent_id}/workflows": {
      "get": {
        "operationId": "getPhoneAgentWorkflows",
        "summary": "List workflows for a phone agent",
        "description": "Returns workflows available to the agent and which are selected.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "phone_agent_id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentWorkflowListDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "updatePhoneAgentWorkflows",
        "summary": "Update phone agent workflows",
        "description": "Set which AI-trigger workflows the phone agent can use as tools during calls.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateAgentWorkflowsDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "phone_agent_id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpdateAgentWorkflowsResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/phone/{phone_agent_id}": {
      "get": {
        "operationId": "getPhoneAgent",
        "summary": "Get an AI phone agent",
        "description": "Get full details of a specific AI phone agent including its voice, language, instructions, phone number, model, and all configuration.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "phone_agent_id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PhoneAgentDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updatePhoneAgent",
        "summary": "Update an AI phone agent",
        "description": "Update an existing AI phone agent. Only the fields you provide will be changed.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdatePhoneAgentPublicDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "phone_agent_id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PhoneAgentDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deletePhoneAgent",
        "summary": "Delete an AI phone agent",
        "description": "Permanently delete an AI phone agent and release its phone number. This action cannot be undone.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "phone_agent_id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response"
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/phone/calls/hand-back": {
      "post": {
        "operationId": "handBackPhoneCall",
        "summary": "Hand back a transferred call",
        "description": "Returns a caller that a Classical IVR transferred to your SIP endpoint. Your SIP leg is hung up, and the IVR continues with the steps after the transfer (usually routing the caller to a team) on the same call, recording and session. Call it instead of hanging up when the caller should continue with the organization. Repeating a successful hand-back returns the same response and ignores its summary. Returns 409 when the session has no transferred call waiting: before your leg answered, or after your leg or the caller hung up.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HandBackCallInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HandBackCallOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/phone/outbound-call": {
      "post": {
        "operationId": "makeOutboundCall",
        "summary": "Make an AI phone call",
        "description": "Initiate an outbound call using an AI phone agent. You can target either an existing contact by ID or a raw phone number in E.164 format. This endpoint is for one-time calls and does not queue requests. Capacity restrictions return HTTP 429; when capacity cannot be checked, HTTP 503 is returned. These admission errors mean no call was started. Use the Sequences API for bulk or scheduled outreach.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MakeOutboundCallDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MakeOutboundCallResponseDto"
                }
              }
            }
          },
          "429": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutboundCallCapacityError"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          },
          "503": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutboundCallCapacityError"
                }
              }
            }
          }
        }
      }
    },
    "/phone/web-calls": {
      "post": {
        "operationId": "createWebCall",
        "summary": "Create an app voice call",
        "tags": [
          "Phone"
        ],
        "description": "Server-only. Requires phone:write and enabled Voice SDK access. Authenticate the customer before choosing their contact and destination. Return these temporary credentials only to that customer.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateWebCallDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebCallCredentialsDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/phone/web-calls/{callId}/connect": {
      "post": {
        "operationId": "connectWebCall",
        "summary": "Start a connected app voice call",
        "tags": [
          "Phone"
        ],
        "description": "SDK call. Authorize with the call controlToken, after publishing microphone audio. Repeated activation does not start another call.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "callId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebCallSuccessDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/phone/web-calls/{callId}": {
      "get": {
        "operationId": "getWebCall",
        "summary": "Get app voice call status",
        "tags": [
          "Phone"
        ],
        "description": "Authorize with this call’s controlToken.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "callId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebCallStatusDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "endWebCall",
        "summary": "End an app voice call",
        "tags": [
          "Phone"
        ],
        "description": "Authorize with this call’s controlToken. Ends all participants in this call. Repeated requests are safe.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "callId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebCallSuccessDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/redaction/message": {
      "post": {
        "operationId": "redactMessage",
        "summary": "Redact a specific message",
        "description": "Redact a specific message by message ID, including any attached images",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RedactMessageDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "itemId": {
                      "type": "string"
                    },
                    "redactionType": {
                      "type": "string",
                      "enum": [
                        "message",
                        "session"
                      ]
                    },
                    "affectedCount": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "itemId",
                    "redactionType",
                    "affectedCount"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/redaction/session": {
      "post": {
        "operationId": "redactSession",
        "summary": "Redact all messages in a session",
        "description": "Redact all messages in a session by session ID, including any attached images",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RedactSessionDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "itemId": {
                      "type": "string"
                    },
                    "redactionType": {
                      "type": "string",
                      "enum": [
                        "message",
                        "session"
                      ]
                    },
                    "affectedCount": {
                      "type": "number"
                    },
                    "messagesRedacted": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "success",
                    "message",
                    "itemId",
                    "redactionType",
                    "affectedCount",
                    "messagesRedacted"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/resource-usage/{resource_type}/{resource_id}/conversations": {
      "get": {
        "operationId": "listResourceConversations",
        "summary": "List conversations that used a resource",
        "description": "Reverse lookup: list the conversations where a given action, instruction, or KB item was used, newest first. Returns one row per conversation with the reply count, ticket number, last message, and first/last-used timestamps. Defaults to `applied` usage (the resource actually fired); pass `usageKind=available` to see where an instruction was in context but may not have fired.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "enum": [
                "applied",
                "available"
              ]
            },
            "in": "query",
            "name": "usageKind",
            "required": false
          },
          {
            "schema": {},
            "in": "query",
            "name": "from",
            "required": false
          },
          {
            "schema": {},
            "in": "query",
            "name": "to",
            "required": false
          },
          {
            "schema": {
              "default": 20,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "in": "query",
            "name": "limit",
            "required": false
          },
          {
            "schema": {
              "default": 0,
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "in": "query",
            "name": "offset",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "action",
                "instruction",
                "knowledge"
              ]
            },
            "in": "path",
            "name": "resource_type",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "resource_id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicResourceUsageConversationsDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/resource-usage/{resource_type}/{resource_id}/usage-summary": {
      "get": {
        "operationId": "getResourceUsageSummary",
        "summary": "Get usage counts for a resource",
        "description": "Aggregate usage for a given action, instruction, or KB item: distinct sessions and total replies where it was applied, the available counterpart (for instructions, to compute apply-rate), and first/last-used timestamps. Optionally bound by a date range.",
        "parameters": [
          {
            "schema": {},
            "in": "query",
            "name": "from",
            "required": false
          },
          {
            "schema": {},
            "in": "query",
            "name": "to",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "action",
                "instruction",
                "knowledge"
              ]
            },
            "in": "path",
            "name": "resource_type",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "resource_id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicResourceUsageSummaryDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/resource-usage/{resource_type}": {
      "get": {
        "operationId": "listResourceUsage",
        "summary": "List usage counts for all resources of a type",
        "description": "Bulk usage: one row per action, instruction, or KB item in the org, with available / applied (used) counts, the handoff count, and first/last-used timestamps — most recently used first. The per-item alternative to calling `usage-summary` once per id. Paginated via the opaque `cursor`; optionally bound by a date range.",
        "parameters": [
          {
            "schema": {},
            "in": "query",
            "name": "from",
            "required": false
          },
          {
            "schema": {},
            "in": "query",
            "name": "to",
            "required": false
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "cursor",
            "required": false,
            "description": "Opaque pagination cursor from a previous `next`"
          },
          {
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 250
            },
            "in": "query",
            "name": "limit",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "action",
                "instruction",
                "knowledge"
              ]
            },
            "in": "path",
            "name": "resource_type",
            "required": true,
            "description": "The kind of AI resource to look up: `action` (a tool the AI can call), `instruction` (an AI instruction/behavior), or `knowledge` (a knowledge base item)."
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicResourceUsageListDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/secrets": {
      "post": {
        "operationId": "createSecret",
        "summary": "Create a secret",
        "description": "Store a new named secret for your organization. The value is encrypted at rest and is never returned — not by this endpoint, and not by any other. Reference it from an action header or workflow field as `{{secrets.<name>}}`; OpenCX substitutes the value server-side at execution time. Returns 409 if a secret with this name already exists — use `PUT /secrets` if you want to create-or-replace instead.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WriteSecretInputDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SecretMetadataDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "upsertSecret",
        "summary": "Create or replace a secret",
        "description": "Create the secret, or replace the value of the one already using this name. Idempotent — safe to call on every deploy to push the current credential without checking whether it exists. Rotating a secret takes effect immediately for every action and workflow referencing it by name; nothing needs to be re-pointed. The value is encrypted at rest and is never returned.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WriteSecretInputDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SecretMetadataDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/sequences": {
      "post": {
        "operationId": "createSequence",
        "summary": "Create an outbound sequence, as a draft",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSequenceDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SequenceDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listSequences",
        "summary": "List outbound sequences",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListSequencesDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/sequences/enrichment-catalog": {
      "get": {
        "operationId": "listEnrichmentPaths",
        "summary": "List the enrichment paths a sequence column may project",
        "description": "Every jsonpath the People table can show, with its resolved type. Column paths must come from this catalog — anything outside it is rejected by name.",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnrichmentCatalogDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/sequences/voice-senders": {
      "get": {
        "operationId": "listVoiceSenders",
        "summary": "List the phone agents this org can bind as sequence voice senders",
        "description": "Every AI phone agent of the organization with its bindability verdict. `eligible` agents are accepted by setSequenceSenders on the voice channel; ineligible ones carry the reason — `no_caller_number` means attach a verified number to the agent first (setPhoneAgentCallerNumber). Each entry also carries the mission the agent already has: `first_message` (spoken verbatim before the step's call brief can influence anything) and `persona`. Eligibility says an agent CAN dial; those two say whether it should dial for THIS sequence.",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VoiceSendersDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/sequences/voice-trunks": {
      "get": {
        "operationId": "listVoiceTrunks",
        "summary": "List the SIP trunks a sequence's Human voice step can call through",
        "description": "The organization's own SIP trunks. A voice step with `handled_by: \"human\"` is called by a team of agents instead of an AI phone agent, and its calls go out through one of these (`trunk_id`). A trunk the platform hosts is never listed: team calls only ride your own trunk. Empty when the organization has none — connect one under Settings → SIP first.",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SequenceVoiceTrunksDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/sequences/email-senders": {
      "get": {
        "operationId": "listEmailSenders",
        "summary": "List the mailboxes this org can bind as sequence email senders",
        "description": "Every email mailbox of the organization with its bindability verdict AND its health NUMBERS. `eligible` mailboxes are accepted by setSequenceSenders on the email channel — including a mailbox still provisioning (`pending`/`created`): binding it early is safe, sending itself waits for the mailbox to finish becoming `active` on its own. Ineligible ones carry the reason (`not_active` — a human hold or the mailbox being removed, neither of which resolves on its own; `domain_not_live` — its domain lapsed, so sending would fail authentication). `health` carries warm-up status, inbox rate, spam rate, an overall score, warming-since, and the share of recent real sends that hard-bounced with its sample size. There is deliberately no pass/fail: a null is \"not known yet\" (common for a new mailbox), never \"bad\", and nothing here blocks a send or a binding.",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailSendersDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/sequences/{sequenceId}": {
      "get": {
        "operationId": "getSequence",
        "summary": "Get an outbound sequence",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "sequenceId",
            "required": true,
            "description": "The unique identifier of the sequence"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SequenceDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateSequence",
        "summary": "Update a sequence — name, brief, criteria, reply instructions, settings",
        "description": "Partial: only provided fields change. `settings` merges field-wise over the stored settings (`office_hours_id: null` clears the pointer back to the org default). Allowed in any status — settings are read live by the engine, so changes apply to the next send decision. Steps are NOT edited here: use setSequenceSteps (drafts) or editSequenceSteps (any status).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSequenceDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "sequenceId",
            "required": true,
            "description": "The unique identifier of the sequence"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SequenceDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/sequences/{sequenceId}/replies": {
      "get": {
        "operationId": "listSequenceReplies",
        "summary": "List the most recent replies to a sequence",
        "description": "Who answered, newest first, with the inbox session each reply started. Each reply carries a short preview of what the contact said — but only for a key that may read conversations (chat-sessions:read); without it the preview is null.",
        "parameters": [
          {
            "schema": {
              "default": 5,
              "type": "integer",
              "minimum": 1,
              "maximum": 50
            },
            "in": "query",
            "name": "limit",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "sequenceId",
            "required": true,
            "description": "The unique identifier of the sequence"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SequenceRepliesDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/sequences/number-pool-call-metrics": {
      "get": {
        "operationId": "getSequenceNumberPoolCallMetrics",
        "summary": "Read per-number metrics for sequence calls made through number pools",
        "description": "Read-only, workspace-scoped metrics from persisted pool attempts and call records. Excludes ordinary single-number/trunk calls and one-time calls. Returns zero totals and no rows when no pool calls match. Historical callers remain included after number replacement or pool reassignment. Filter by call start time (maximum 31 days), pool, agent, or sequence; group by caller number, UTC day, or retry position. No calls or settings are changed. Requires sequences:read.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
            },
            "in": "query",
            "name": "start_date",
            "required": true,
            "description": "Inclusive call start time, with timezone."
          },
          {
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
            },
            "in": "query",
            "name": "end_date",
            "required": true,
            "description": "Exclusive call start time, with timezone. Maximum window: 31 days."
          },
          {
            "schema": {
              "default": "caller_number",
              "type": "string",
              "enum": [
                "caller_number",
                "day",
                "attempt"
              ]
            },
            "in": "query",
            "name": "group_by",
            "required": false,
            "description": "Group by recorded pool caller number, UTC day, or 1-based attempt position within a sequence step."
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "query",
            "name": "pool_id",
            "required": false,
            "description": "Pool used at call time, including a pool that has since been deleted."
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "query",
            "name": "sequence_id",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "query",
            "name": "agent_id",
            "required": false
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NumberPoolCallMetricsResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/sequences/{sequenceId}/call-attempts": {
      "get": {
        "operationId": "listSequenceCallAttempts",
        "summary": "List a sequence's team calls",
        "description": "Every call a Human voice step placed for a team, newest first: who was called, whether the call is still live, how it ended, which agent took it, and whether that agent corrected the result. Filter by step or result; page with `before`. AI voice steps are not listed here — their outcomes are on the contact events.",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "in": "query",
            "name": "step_index",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "answered",
                "no_answer",
                "busy",
                "failed",
                "missed",
                "voicemail",
                "wrong_number"
              ]
            },
            "in": "query",
            "name": "result",
            "required": false
          },
          {
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            },
            "in": "query",
            "name": "limit",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            },
            "in": "query",
            "name": "before",
            "required": false,
            "description": "Page cursor: the `next_before` of the previous page, passed back as is."
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "sequenceId",
            "required": true,
            "description": "The unique identifier of the sequence"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SequenceCallAttemptsDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/sequences/{sequenceId}/stats": {
      "get": {
        "operationId": "getSequenceStats",
        "summary": "Get an outbound sequence's numbers",
        "description": "How many people are enrolled, how many a launch would reach, how many have been contacted, how many answered, how many will never be reached, and how many are waiting on a human. The last two also name the people themselves, so the caller can act on them. The same rollup the list rows carry, addressed singly — every surface reads these through one implementation.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "sequenceId",
            "required": true,
            "description": "The unique identifier of the sequence"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SequenceStatsDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/sequences/{sequenceId}/steps": {
      "put": {
        "operationId": "setSequenceSteps",
        "summary": "Replace the step list of a DRAFT sequence",
        "description": "Full replace, drafts only — the authoring call in the enroll-first flow (create the shell, enroll and qualify a real audience, then author steps). On a launched sequence use editSequenceSteps instead; a live step list is never blind-replaced under people mid-journey. The response is the sequence plus variable_coverage: for every source the steps bind, how many enrolled people have a value.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetSequenceStepsDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "sequenceId",
            "required": true,
            "description": "The unique identifier of the sequence"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SequenceStepsWriteDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "editSequenceSteps",
        "summary": "Surgically edit steps — update content/delays, append, remove (any status)",
        "description": "One transactional batch of typed edits. Execution order is fixed: removes (highest index first), then appends, then updates — indices address the array AFTER earlier phases of the same batch. Content/delay updates are allowed on any step (people already past it keep what they received); append is always allowed (completed people do not revive); remove is refused for any step somebody already reached. Any illegal edit rejects the whole batch, named by its position. The response is the sequence plus variable_coverage for every source the resulting steps bind.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EditSequenceStepsDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "sequenceId",
            "required": true,
            "description": "The unique identifier of the sequence"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SequenceStepsWriteDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/sequences/{sequenceId}/data-keys": {
      "get": {
        "operationId": "listSequenceDataKeys",
        "summary": "List the attached-data keys a sequence's people carry",
        "description": "Every top-level key of the data attached to enrolled people (extra_data), with how many people in a bounded sample have a value at it. A key here is usable verbatim as a step variable's source. Read it to bind data you did not attach yourself, or to check that the keys you attached landed as spelled.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "sequenceId",
            "required": true,
            "description": "The unique identifier of the sequence"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SequenceDataKeysDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/sequences/{sequenceId}/contacts": {
      "post": {
        "operationId": "addSequenceContacts",
        "summary": "Enroll people into an outbound sequence — returns a per-person outcome",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AddSequenceContactsDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "sequenceId",
            "required": true,
            "description": "The unique identifier of the sequence"
          }
        ],
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AddSequenceContactsOutputDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listSequenceContacts",
        "summary": "List a campaign's people (paginated summary rows)",
        "description": "Summary rows for the sequence audience — identities, status, fit, judgment tallies. Sorted fit-highest-first (never-judged last); pass `next_cursor` back as `cursor` for the next page. Verdict paragraphs and enrichment live on the per-person detail read.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "enum": [
                "candidate",
                "active",
                "parked",
                "exited",
                "completed"
              ]
            },
            "in": "query",
            "name": "status",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "qualified",
                "not_qualified",
                "never_judged"
              ]
            },
            "in": "query",
            "name": "band",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            },
            "in": "query",
            "name": "batch_key",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 500
            },
            "in": "query",
            "name": "cursor",
            "required": false
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            },
            "in": "query",
            "name": "limit",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "sequenceId",
            "required": true,
            "description": "The unique identifier of the sequence"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListSequenceContactsDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/sequences/{sequenceId}/launch-preview": {
      "get": {
        "operationId": "getLaunchPreview",
        "summary": "What launching WOULD do, without doing it",
        "description": "Mirrors the launch clause for clause: `will_send` (a forecast — consent is re-checked per message), `held` with the reason each group is staying put, `blockers` — the things launch refuses on — and `pending_templates`, templates still in Meta review, which do NOT block: people arm and sends start the moment approval clears. Check this before launching — launching sends real messages to real people.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "sequenceId",
            "required": true,
            "description": "The unique identifier of the sequence"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LaunchPreviewDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/sequences/{sequenceId}/launch": {
      "post": {
        "operationId": "launchSequence",
        "summary": "Launch an outbound sequence — arms candidates for sending",
        "description": "If the launch preview carries a regulatory_notice (voice steps into regulated countries), show it to a person and pass regulatory_acknowledged: true so the confirmation is recorded with the notice text. Informational — never blocks.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/LaunchSequenceInputDto"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "sequenceId",
            "required": true,
            "description": "The unique identifier of the sequence"
          }
        ],
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LaunchSequenceOutputDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/sequences/{sequenceId}/pause": {
      "post": {
        "operationId": "pauseSequence",
        "summary": "Pause an outbound sequence — sending stops now; people keep their place",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "sequenceId",
            "required": true,
            "description": "The unique identifier of the sequence"
          }
        ],
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GenericResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/sequences/{sequenceId}/resume": {
      "post": {
        "operationId": "resumeSequence",
        "summary": "Resume a paused sequence",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "sequenceId",
            "required": true,
            "description": "The unique identifier of the sequence"
          }
        ],
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GenericResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/sequences/{sequenceId}/steps/{stepIndex}/delay": {
      "patch": {
        "operationId": "updateSequenceStepDelay",
        "summary": "Change how long a step waits before it sends",
        "description": "Minutes after the previous step — 30 for half an hour, 1440 for a day. Step 0 must stay 0: the first message is armed by launch or enrolment rather than by a delay. Also editable from the dashboard.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSequenceStepDelayDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "sequenceId",
            "required": true,
            "description": "The unique identifier of the sequence"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "in": "path",
            "name": "stepIndex",
            "required": true,
            "description": "Zero-based position in the steps"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SequenceDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/sequences/{sequenceId}/columns": {
      "put": {
        "operationId": "setSequenceColumns",
        "summary": "Set the columns the sequence's People table shows",
        "description": "Replace-set of `{key, label, path}` columns projected from each person’s enrichment, so the People table shows the evidence the judge saw rather than a bare fit score. Paths come from the enrichment catalog (`type` resolved server-side, never accepted from the caller) or project the caller-attached bag — `$.extra_data.plan` — where YOU supply `type`, and only plain member/subscript steps are accepted. Anything else is rejected by name.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetSequenceColumnsDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "sequenceId",
            "required": true,
            "description": "The unique identifier of the sequence"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SequenceDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/sequences/{sequenceId}/senders": {
      "put": {
        "operationId": "setSequenceSenders",
        "summary": "Set the senders a sequence may send from (replace-set per channel)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetSequenceSendersDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "sequenceId",
            "required": true,
            "description": "The unique identifier of the sequence"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SequenceSendersDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listSequenceSenders",
        "summary": "List the senders bound to a sequence",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "sequenceId",
            "required": true,
            "description": "The unique identifier of the sequence"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SequenceSendersDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/sequences/{sequenceId}/contacts/{contactId}": {
      "get": {
        "operationId": "getSequenceContact",
        "summary": "One person's full record: verdicts, qualification, enrichment",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "sequenceId",
            "required": true,
            "description": "The unique identifier of the sequence"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "contactId",
            "required": true,
            "description": "The person's contact id (from enroll results or the people list)"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SequenceContactDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateSequenceContact",
        "summary": "Correct a person's name or the handles the sequence sends to",
        "description": "Editable only while they are a candidate or parked — once someone is sending, a claim may already be addressed to the handle on the row. Handles are normalized the same way enrollment normalizes them, and a handle already held by someone else in this sequence is refused by name rather than surfacing a unique-index error.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSequenceContactDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "sequenceId",
            "required": true,
            "description": "The unique identifier of the sequence"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "contactId",
            "required": true,
            "description": "The person's contact id (from enroll results or the people list)"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SequenceContactDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/sequences/{sequenceId}/contacts/{contactId}/events": {
      "get": {
        "operationId": "getSequenceContactEvents",
        "summary": "One person's journey ledger — every step outcome, oldest first",
        "description": "The raw per-person event log: enrollment, sends, skips (with reasons), deferrals, channel outcomes (delivered/read/replied, answered/no answer/busy/failed), parks and exits. Each event carries the inbox session id of its send when one exists — voice dials always do; WhatsApp sends gain one when the person replies. This is how you answer \"what happened to this person\" and \"why did/didn't step N fire\".",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "sequenceId",
            "required": true,
            "description": "The unique identifier of the sequence"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "contactId",
            "required": true,
            "description": "The person's contact id (from enroll results or the people list)"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SequenceContactEventsDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/sequences/{sequenceId}/contacts/{contactId}/steps/{stepIndex}/preview": {
      "get": {
        "operationId": "previewSequenceStepForContact",
        "summary": "What one person will get at one step, rendered",
        "description": "Rendered by the same code the send path runs: the step's template filled in for this person, their personalization if they have one, or — once the step went out — the send record of what they actually received. A blocked render names the reason the person would park (missing data, an unsendable value, an unreadable template).",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "sequenceId",
            "required": true,
            "description": "The unique identifier of the sequence"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "contactId",
            "required": true,
            "description": "The person's contact id (from enroll results or the people list)"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "in": "path",
            "name": "stepIndex",
            "required": true,
            "description": "Zero-based position in the step list"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SequenceStepPreviewDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/sequences/{sequenceId}/contacts/{contactId}/steps/{stepIndex}/personalization": {
      "put": {
        "operationId": "setSequenceStepPersonalization",
        "summary": "Hand-write one step for one person",
        "description": "Stores a rendered snapshot the sequence sends to this person INSTEAD of the step: email as subject + html (text derived when omitted), a voice call brief, or literal slot values on the step's own WhatsApp template. Only for steps the person has not reached. A person parked on this step for missing data is released — the snapshot has no holes. Editing the step later never touches it; clear it to go back to the template.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetSequenceStepPersonalizationDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "sequenceId",
            "required": true,
            "description": "The unique identifier of the sequence"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "contactId",
            "required": true,
            "description": "The person's contact id (from enroll results or the people list)"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "in": "path",
            "name": "stepIndex",
            "required": true,
            "description": "Zero-based position in the step list"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SetSequenceStepPersonalizationOutputDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "clearSequenceStepPersonalization",
        "summary": "Remove a person's hand-written step — back to the template",
        "description": "Idempotent: nothing to clear returns cleared=false, never an error.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "sequenceId",
            "required": true,
            "description": "The unique identifier of the sequence"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "contactId",
            "required": true,
            "description": "The person's contact id (from enroll results or the people list)"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "in": "path",
            "name": "stepIndex",
            "required": true,
            "description": "Zero-based position in the step list"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClearSequenceStepPersonalizationOutputDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/sequences/{sequenceId}/contacts/{contactId}/include": {
      "post": {
        "operationId": "includeSequenceContact",
        "summary": "Override a below-cutoff judgment (\"include anyway\")",
        "description": "Clears fit back to NULL so the person arms at the next launch/auto-activate wave. Verdicts stay on record; the override is written to the sequence ledger.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "sequenceId",
            "required": true,
            "description": "The unique identifier of the sequence"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "contactId",
            "required": true,
            "description": "The person's contact id (from enroll results or the people list)"
          }
        ],
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IncludeSequenceContactDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/sequences/{sequenceId}/contacts/{contactId}/skip-step": {
      "post": {
        "operationId": "skipSequenceStep",
        "summary": "Skip one pending step for a contact",
        "description": "Marks only this enrollment. Does not resume or unpark it. Skipped waits are preserved, including when continuing after a reply. A dispatch already started cannot be skipped. Phone uses channel voice. Retry next-step requests with the same idempotency_key.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SkipSequenceStepBody"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "sequenceId",
            "required": true,
            "description": "The unique identifier of the sequence"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "contactId",
            "required": true,
            "description": "The person's contact id (from enroll results or the people list)"
          }
        ],
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SkipSequenceStepResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/sequences/{sequenceId}/contacts/{contactId}/continue": {
      "post": {
        "operationId": "continueSequenceContact",
        "summary": "Continue the sequence for a person a reply took out of it",
        "description": "A reply concludes a journey — the person exits as \"replied\" and receives no further steps. When that reply was not real engagement (an out-of-office, a \"who is this?\"), this puts them back in: active at the NEXT step, with that step's wait counted from now. Skipped steps are omitted and their waits are added from resume time. The step they answered is never re-sent.\n\nNever an error for \"cannot continue\": `nothing_to_continue` when they replied on the last step or the journey already completed; `not_resumable` when the journey is still in play, dispatch is still in progress, or ended by suppression (consent is not overridden here); `contact_not_found` when there is no live enrollment.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "sequenceId",
            "required": true,
            "description": "The unique identifier of the sequence"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "contactId",
            "required": true,
            "description": "The person's contact id (from enroll results or the people list)"
          }
        ],
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContinueSequenceContactOutputDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/sequences/contacts/{contactId}/sequences": {
      "get": {
        "operationId": "listContactSequences",
        "summary": "Every sequence a contact is in, across the workspace",
        "description": "The cross-sequence read: which sequences hold this contact, their status in each (candidate, active, parked, exited, completed), why they left or parked, and the step they are on. Live enrollments only — a removed person is off the list. Use it before enrolling someone, or when a message arrives and you need to know whether they are mid-sequence.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "contactId",
            "required": true,
            "description": "The person's contact id"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactSequencesDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/sequences/{sequenceId}/contacts/exit": {
      "post": {
        "operationId": "exitSequenceContact",
        "summary": "Remove one person from the sequence",
        "description": "Stops every remaining step for one person. Identify them by `contact_id`, `email` or `phone` — whichever your system holds; send exactly one. Phone numbers and email addresses match regardless of formatting or case.\n\nThe removal is a deletion from your list: they leave every read, and adding them again later enrolls them afresh from the first step rather than resuming where they stopped. What we already sent them is kept — a message that went out cannot be un-sent.\n\nSafe to fire in bulk. A person who was never enrolled, or who is already off the list, comes back as an outcome rather than an error.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExitSequenceContactDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "sequenceId",
            "required": true,
            "description": "The unique identifier of the sequence"
          }
        ],
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExitSequenceContactOutputDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/sequences/{sequenceId}/enrich": {
      "post": {
        "operationId": "enrichSequenceContacts",
        "summary": "Enrich scoped people from org data (async run)",
        "description": "Snapshots everything the org knows about each scoped person (profile, sessions, VOC insights, transcripts) onto their row for the judge to read. Set `wait` for a sample (≤50 people) to get the finished run back in the same call; larger scopes return an immediate ack and stream into the dashboard. Peek a row via the person detail read to inspect what was gathered.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EnrichSequenceContactsDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "sequenceId",
            "required": true,
            "description": "The unique identifier of the sequence"
          }
        ],
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QualificationRunAckDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/sequences/{sequenceId}/judge": {
      "post": {
        "operationId": "judgeSequenceContacts",
        "summary": "Judge scoped people against criteria (async run)",
        "description": "One LLM verdict per person per criterion over their STORED enrichment (enrich first). Must-haves gate, nice-to-haves rank; fit lands on each row, verdicts on their qualification record. Set `wait` to judge a sample (≤50) and read its completion aggregates in the same call — they show where fails/unsures concentrate, so a criterion can be fixed and re-judged immediately. Larger scopes return an immediate ack. Rows with no data at all (no enrichment and no extra_data) are skipped and counted.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JudgeSequenceContactsDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "sequenceId",
            "required": true,
            "description": "The unique identifier of the sequence"
          }
        ],
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QualificationRunAckDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/sequences/{sequenceId}/qualification-runs": {
      "get": {
        "operationId": "listQualificationRuns",
        "summary": "List a campaign's enrich/judge runs, latest first",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "in": "query",
            "name": "limit",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "sequenceId",
            "required": true,
            "description": "The unique identifier of the sequence"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListQualificationRunsDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/sequences/{sequenceId}/qualification-runs/{runId}": {
      "get": {
        "operationId": "getQualificationRun",
        "summary": "One run: status, live counts, completion aggregates",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "sequenceId",
            "required": true,
            "description": "The unique identifier of the sequence"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "runId",
            "required": true,
            "description": "The qualification run id (from the dispatch ack)"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QualificationRunDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/sequences/discovery/search": {
      "post": {
        "operationId": "discoverSequenceContacts",
        "summary": "Semantic audience discovery — match a natural-language ask against what customers actually said, returning candidate people + evidence",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DiscoverCampaignPeopleDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DiscoverCampaignPeopleResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/custom-data-keys": {
      "get": {
        "operationId": "listCustomDataKeys",
        "summary": "List the org's observed custom-data keys (names only)",
        "description": "Every custom-data key ever observed on this org, per bag (contact/session, verified/unverified). Use it to learn what fields exist before authoring analytics filters or campaign qualification criteria; sample actual values via analytics queries.",
        "parameters": [
          {
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "company_custom_data",
                  "contact_custom_data",
                  "contact_non_verified_custom_data",
                  "session_custom_data",
                  "session_editable_custom_data"
                ]
              }
            },
            "in": "query",
            "name": "sources",
            "required": false,
            "description": "Filter to specific bags; default: all four."
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "in": "query",
            "name": "search",
            "required": false,
            "description": "Case-insensitive substring match on the key."
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000
            },
            "in": "query",
            "name": "limit",
            "required": false,
            "description": "Default 500."
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListCustomDataKeysDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/email-fleet/domains/dns": {
      "get": {
        "operationId": "listEmailFleetDnsSetups",
        "summary": "Read sending domain DNS setup",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailFleetDnsSetupsDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/email-fleet/status": {
      "get": {
        "operationId": "getEmailFleetStatus",
        "summary": "Email fleet status (aggregate)",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailFleetStatusDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/email-fleet/domains/suggest": {
      "post": {
        "operationId": "suggestEmailFleetDomains",
        "summary": "Suggest available lookalike sending domains",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SuggestEmailFleetDomainsDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuggestEmailFleetDomainsResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/slack/connection-status": {
      "get": {
        "operationId": "getSlackConnectionStatus",
        "summary": "Get Slack connection status",
        "description": "Returns the connected Slack workspace, or connected: false when no workspace is connected.",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SlackConnectionStatusOutputDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/slack/bot-channels": {
      "get": {
        "operationId": "listSlackBotChannels",
        "summary": "List Slack channels the bot is in",
        "description": "Channels the OpenCX bot has been invited to — the candidates for the handoff notification channel.",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SlackBotChannelsOutputDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/slack/notification-settings": {
      "get": {
        "operationId": "getSlackNotificationSettings",
        "summary": "Get Slack notification settings",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SlackNotificationSettingsOutputDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "updateSlackNotificationSettings",
        "summary": "Update Slack notification settings",
        "description": "Partial update: omitted fields are left unchanged. 404 when Slack is not connected.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSlackNotificationSettingsInputDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SlackNotificationSettingsOutputDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/slack/tag-directory": {
      "get": {
        "operationId": "getSlackTagDirectory",
        "summary": "Get the Slack mention directory",
        "description": "Friendly mention names (e.g. \"billing_oncall\") mapped to the Slack user, usergroup, channel or special target they render as.",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SlackTagDirectoryOutputDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "updateSlackTagDirectory",
        "summary": "Replace the Slack mention directory",
        "description": "Replaces the whole directory. 404 when Slack is not connected.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSlackTagDirectoryInputDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SlackTagDirectoryOutputDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/teams/categories": {
      "get": {
        "operationId": "listTeamCategories",
        "summary": "List team categories",
        "description": "List categories in the current workspace, including categories with no teams. Requires teams:read.",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/GroupCategoryDto"
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createTeamCategory",
        "summary": "Create a team category",
        "description": "Create a workspace category or return the existing category with the same name, ignoring capitalization and surrounding spaces. Requires teams:write.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateGroupCategoryDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GroupCategoryDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/teams": {
      "get": {
        "operationId": "getTeams",
        "summary": "Get all teams",
        "description": "Retrieve all teams for the organization",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/GroupDto"
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createTeam",
        "summary": "Create new team",
        "description": "Create a new team in the organization",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateGroupDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response"
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/teams/{teamId}": {
      "get": {
        "operationId": "getTeam",
        "summary": "Get specific team",
        "description": "Retrieve details of a specific team",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "teamId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/GroupDto"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "updateTeam",
        "summary": "Update team",
        "description": "Update only the supplied fields of an existing team. Omitted fields stay unchanged.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateGroupDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "teamId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response"
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteTeam",
        "summary": "Delete team",
        "description": "Delete an existing team",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "teamId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response"
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/teams/{teamId}/users": {
      "post": {
        "operationId": "addUserToTeam",
        "summary": "Add user to team",
        "description": "Add a user to an existing team",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AddUserToGroupDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "teamId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "user": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "number"
                        },
                        "name": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "email": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "email"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "getUsersInTeam",
        "summary": "Get users in team",
        "description": "Retrieve all users in a specific team, including their availability and chat capacity for routing.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "teamId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/GroupUsersDto"
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/teams/{teamId}/users/{userId}": {
      "delete": {
        "operationId": "removeUserFromTeam",
        "summary": "Remove user from team",
        "description": "Remove a user from a team",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "teamId",
            "required": true
          },
          {
            "schema": {
              "type": "number"
            },
            "in": "path",
            "name": "userId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response"
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/teams/{teamId}/users/available": {
      "get": {
        "operationId": "getAvailableUsersInTeam",
        "summary": "Get available users in team",
        "description": "Retrieve only currently available users in a team, including their availability and chat capacity.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "teamId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/GroupUsersDto"
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/training": {
      "get": {
        "operationId": "listTrainings",
        "summary": "List all trainings",
        "description": "List all training scenarios for your organization. Trainings teach the AI how to respond to specific situations. Supports filtering by search term, type, and draft status, with pagination.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "search",
            "required": false,
            "description": "Case-insensitive search on title or content"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "BEHAVIORAL",
                "SCENARIO_SPECIFIC"
              ]
            },
            "in": "query",
            "name": "type",
            "required": false,
            "description": "Filter by type: BEHAVIORAL or SCENARIO_SPECIFIC"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            },
            "in": "query",
            "name": "is_draft",
            "required": false,
            "description": "Filter by draft status"
          },
          {
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "in": "query",
            "name": "limit",
            "required": false,
            "description": "Max items to return (1-100, default 50)"
          },
          {
            "schema": {
              "default": 0,
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "in": "query",
            "name": "offset",
            "required": false,
            "description": "Number of items to skip (default 0)"
          },
          {
            "schema": {
              "default": "created_at",
              "type": "string",
              "enum": [
                "created_at",
                "handoff_count"
              ]
            },
            "in": "query",
            "name": "sort_by",
            "required": false,
            "description": "Sort by field: created_at (default) or handoff_count (most handoffs first)"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "metadata",
            "required": false,
            "description": "Filter by metadata — JSON object of key-value pairs to match (uses jsonb @> containment)"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListTrainingsOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createTraining",
        "summary": "Create a training",
        "description": "Create a new training scenario. Use type \"BEHAVIORAL\" for always-active instructions (tone, guardrails) or \"SCENARIO_SPECIFIC\" (default) for question-triggered scenarios.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateTrainingPublicDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TrainingPublicResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/training/search": {
      "post": {
        "operationId": "searchTrainingKnowledge",
        "summary": "Semantic search across training and knowledge base",
        "description": "Search across all training scenarios and knowledge base items using natural language. Returns results ranked by semantic relevance with a 0-100 relevance score. Use this to find existing content before creating new training scenarios.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SearchTrainingKnowledgeInputDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchTrainingKnowledgeResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/training/directories/tree": {
      "get": {
        "operationId": "getTrainingDirectoryTree",
        "summary": "Get directory tree",
        "description": "Get all directories with their trainings, plus uncategorized trainings. Useful for getting a full overview of how trainings are organized.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            },
            "in": "query",
            "name": "show_drafts",
            "required": false,
            "description": "Include draft trainings (default: true)"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            },
            "in": "query",
            "name": "show_published",
            "required": false,
            "description": "Include published trainings (default: true)"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TrainingDirectoryTreePublicDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/training/directories": {
      "get": {
        "operationId": "listTrainingDirectories",
        "summary": "List training directories",
        "description": "List all directories used to organize trainings.",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CustomTrainingDirectoriesDto"
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createTrainingDirectory",
        "summary": "Create a training directory",
        "description": "Create a new directory for organizing trainings. Pass parent_id to create it as a sub-directory.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateTrainingDirectoryInputDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomTrainingDirectoriesDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/training/directories/{directory_id}": {
      "put": {
        "operationId": "updateTrainingDirectory",
        "summary": "Update a training directory",
        "description": "Rename and/or move a training directory. parent_id null moves it to the top level. Moving a directory under itself or one of its own sub-directories is rejected.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateTrainingDirectoryInputDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "directory_id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomTrainingDirectoriesDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteTrainingDirectory",
        "summary": "Delete a training directory",
        "description": "Delete a training directory and all trainings inside it. This action cannot be undone.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "directory_id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response"
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/training/ai-profile": {
      "get": {
        "operationId": "getAiProfile",
        "summary": "Get AI profile",
        "description": "Get the AI agent profile settings for your organization.",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiProfileOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateAiProfile",
        "summary": "Update AI profile",
        "description": "Partially update the AI agent profile settings for your organization.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateAiProfileInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiProfileOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/training/ai-profile/publish": {
      "post": {
        "operationId": "publishAiProfileDraft",
        "summary": "Publish AI profile draft",
        "description": "Promote draft_prompt_message to prompt_message and clear the draft.",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublishAiProfileDraftOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/training/ai-profile/discard-draft": {
      "post": {
        "operationId": "discardAiProfileDraft",
        "summary": "Discard AI profile draft",
        "description": "Clear draft_prompt_message without publishing.",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DiscardAiProfileDraftOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/training/{instructionId}/versions": {
      "get": {
        "operationId": "getTrainingVersionHistory",
        "summary": "Get version history",
        "description": "Get the full version history for a training. Each publish creates an immutable version snapshot.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "instructionId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/VersionHistoryItemDto"
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/training/{instructionId}/versions/{version}/revert": {
      "post": {
        "operationId": "revertTrainingVersion",
        "summary": "Revert to a previous version",
        "description": "Instantly publish a previous version as a new version. The old version content becomes the new active version.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RevertTrainingVersionInputDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "instructionId",
            "required": true
          },
          {
            "schema": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            },
            "in": "path",
            "name": "version",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TrainingPublicResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/training/{id}": {
      "get": {
        "operationId": "getTraining",
        "summary": "Get a training",
        "description": "Get a single training by ID.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TrainingPublicResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "updateTraining",
        "summary": "Update a training",
        "description": "Update an existing training.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateTrainingPublicDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TrainingPublicResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteTraining",
        "summary": "Delete a training",
        "description": "Permanently delete a training. This action cannot be undone.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response"
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/training/{id}/restrictions": {
      "put": {
        "operationId": "updateTrainingRestrictions",
        "summary": "Update instruction restrictions",
        "description": "Set the contact-segment and/or channel restrictions for an instruction without changing its content. An empty array clears that restriction (available everywhere).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateTrainingRestrictionsDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TrainingPublicResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/training/{id}/diff": {
      "put": {
        "operationId": "applyTrainingDiff",
        "summary": "Apply targeted diff edits to a training scenario",
        "description": "Creates inline diff suggestions in the instruction body that users can accept or reject in the dashboard editor.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApplyTrainingDiffDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "artifact_id": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                    },
                    "instruction_id": {
                      "type": "string"
                    },
                    "diff_html": {
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    },
                    "change_count": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "artifact_id",
                    "instruction_id",
                    "diff_html",
                    "title",
                    "change_count"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/training/{id}/draft": {
      "put": {
        "operationId": "toggleTrainingDraft",
        "summary": "Toggle draft status",
        "description": "Publish or unpublish a training. Draft trainings are saved but not used by the AI.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ToggleDraftInputDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response"
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/training/{id}/publish": {
      "post": {
        "operationId": "publishTraining",
        "summary": "Publish a draft training scenario",
        "description": "Publish a draft instruction, making it active for the AI agent. All pending diff suggestions must be accepted or rejected first.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublishTrainingInputDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TrainingPublicResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/training/{id}/move": {
      "post": {
        "operationId": "moveTrainingToDirectory",
        "summary": "Move a training to a directory",
        "description": "Move a training into a directory, or set directory_id to null to uncategorize it.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MoveTrainingInputDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response"
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/training/{id}/metadata": {
      "patch": {
        "operationId": "updateTrainingMetadata",
        "summary": "Update training metadata",
        "description": "Merge key-value pairs into the training metadata. Existing keys not included in the request are preserved. Set a key to null to remove it.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateTrainingMetadataDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TrainingPublicResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/users": {
      "get": {
        "operationId": "listOrgUsers",
        "summary": "List organization users",
        "description": "Retrieve users who belong to the organization. Use the optional query to search by name or email.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "query",
            "name": "q",
            "required": false,
            "description": "Optional case-insensitive search over user name and email"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/OrgUserSummary"
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/users/{user_id}": {
      "get": {
        "operationId": "getOrgUser",
        "summary": "Get organization user",
        "description": "Retrieve a single organization user and include their current team memberships and availability.",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            },
            "in": "path",
            "name": "user_id",
            "required": true,
            "description": "Organization user ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrgUserDetail"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteOrgUser",
        "summary": "Remove a user from the organization",
        "description": "Remove a user's organization membership. Also removes their team memberships and availability in this organization and signs them out everywhere. Their account and historical activity are preserved, and memberships in other organizations are unaffected. The organization owner cannot be removed.",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            },
            "in": "path",
            "name": "user_id",
            "required": true,
            "description": "Organization user ID"
          }
        ],
        "responses": {
          "204": {
            "description": "Default Response"
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/users/batch-delete": {
      "post": {
        "operationId": "batchDeleteOrgUsers",
        "summary": "Remove multiple users from the organization",
        "description": "Remove up to 25 users from the organization in one call. Users are processed independently — one failure never aborts the rest — and the response reports a status per user. Same semantics as removing a single user.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BatchDeleteOrgUsersDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BatchDeleteOrgUsersResultDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/users/invite": {
      "post": {
        "operationId": "inviteUser",
        "summary": "Invite a user to the organization",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InviteUserPublicDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response"
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/roles": {
      "get": {
        "operationId": "listRoles",
        "summary": "List roles",
        "description": "Retrieve the roles defined in the organization (built-in and custom) with their permissions. Match `id` against the `roles` array on organization users.",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/RolePublicDto"
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/roles/{role_id}": {
      "get": {
        "operationId": "getRole",
        "summary": "Get role",
        "description": "Retrieve a single role by ID with its permissions.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "role_id",
            "required": true,
            "description": "Role ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RolePublicDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/insights": {
      "post": {
        "operationId": "getVocInsights",
        "summary": "Get customer insights",
        "description": "Retrieve customer insights (paginated response)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GetVocQueryDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicPaginatedInsightsDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/insights/categories": {
      "get": {
        "operationId": "getCategories",
        "summary": "Get categories",
        "description": "Retrieve categories for customer feedback",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "enum": [
                "base",
                "suggested",
                "user_defined"
              ]
            },
            "in": "query",
            "name": "type",
            "required": false
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "search",
            "required": false,
            "description": "Case-insensitive keyword match on category name or description."
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PublicCategoryDto"
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createCategory",
        "summary": "Create a category",
        "description": "Create a new user-defined category.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateVocCategoryDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicCategoryDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/insights/categories/usage": {
      "get": {
        "operationId": "getCategoryUsage",
        "summary": "Get category usage",
        "description": "Active category counts by type, the total, and the cap.",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicCategoryUsageDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/insights/settings": {
      "get": {
        "operationId": "getVocSettings",
        "summary": "Get VOC settings",
        "description": "Public subset of Voice-of-Customer settings (mirrors dashboard field names). Currently returns only `custom_analysis_instructions` (Customer Insights → Settings → AI Instructions). Does not return webhooks, notify lists, alert/merge toggles, category-suggestion settings, or other internal fields.",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicVocSettingsDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "updateVocSettings",
        "summary": "Update VOC settings",
        "description": "Partial update of the public VOC settings subset. Accepts only `custom_analysis_instructions` (max 1000 chars; null clears). Unknown keys are rejected. Prompt changes apply to future analyses only. Non-public settings remain dashboard-only.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdatePublicVocSettingsDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicVocSettingsDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/insights/categories/{categoryId}": {
      "put": {
        "operationId": "updateCategory",
        "summary": "Update a category",
        "description": "Rename or re-describe a category. Suggested categories must be approved first.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateCategoryDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "categoryId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicCategoryDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/insights/categories/approve": {
      "post": {
        "operationId": "approveCategory",
        "summary": "Approve a suggested category",
        "description": "Promote AI-suggested categories to user-defined (permanent) ones. Pass `categoryId` for one, or `categoryIds` to approve up to 100 at once. Bulk is best-effort and returns a `{ succeeded, failed }` summary.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicApproveSuggestionDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/PublicCategoryDto"
                    },
                    {
                      "$ref": "#/components/schemas/PublicBulkCategoryResultDto"
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/insights/categories/reject": {
      "post": {
        "operationId": "rejectCategory",
        "summary": "Reject a suggested category",
        "description": "Reject AI-suggested categories and reassign their insights to `fallbackCategoryId`. Pass `categoryId` for one, or `categoryIds` to reject up to 100 at once (all reassigned to the same fallback). Bulk is best-effort and returns a `{ succeeded, failed }` summary.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicRejectSuggestionDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/PublicCategoryDto"
                    },
                    {
                      "$ref": "#/components/schemas/PublicBulkCategoryResultDto"
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/insights/{id}": {
      "get": {
        "operationId": "getVocInsight",
        "summary": "Get a specific customer insight",
        "description": "Retrieve detailed information about a specific insight",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicInsight"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/insights/{id}/archive": {
      "post": {
        "operationId": "archiveInsight",
        "summary": "Archive a customer insight",
        "description": "Archives an insight with a resurface policy (until_escalating, until_count, or forever). Forever requires a reason.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ArchiveInsightDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicInsight"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/insights/{id}/unarchive": {
      "post": {
        "operationId": "unarchiveInsight",
        "summary": "Unarchive a customer insight",
        "description": "Removes archive state so the insight appears in active views again.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicInsight"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/insights/{id}/resolve": {
      "post": {
        "operationId": "resolveInsight",
        "summary": "Mark an insight as resolved",
        "description": "Resolves a customer insight and optionally adds resolution details",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response"
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/insights/{id}/assign": {
      "post": {
        "operationId": "assignInsight",
        "summary": "Assign insight to a group (team)",
        "description": "Assigns a customer insight to a specific group (team)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AssignInsightDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response"
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/whatsapp/templates/catalog": {
      "get": {
        "operationId": "listWhatsappTemplateCatalog",
        "summary": "List WhatsApp templates, flattened for picking one",
        "description": "Every template in the org reduced to what a picker chooses on: body text, its placeholder keys, category, approval status, and whether it is sendable today. Sendable ones come first. `unreadable_wabas` being non-empty means templates are MISSING from the list, not absent from the org.",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WhatsAppTemplateCatalogDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/whatsapp/senders": {
      "get": {
        "operationId": "listWhatsappSenders",
        "summary": "List the WhatsApp numbers this organization can send from",
        "description": "The enabled numbers, with display details. Anything listed here is accepted as a sequence sender.",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WhatsAppSendersDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/whatsapp/templates": {
      "post": {
        "operationId": "createWhatsappTemplateDraft",
        "summary": "Submit a new WhatsApp template for Meta approval",
        "description": "For when nothing in the org fits. Takes header/body/footer text — the components payload is assembled server-side and the WABA resolved — and submits it. It comes back PENDING: review takes minutes to hours, work can continue meanwhile, and a sequence referencing it can even launch — sends start the moment it is APPROVED.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateWhatsAppTemplateDraftDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateWhatsAppTemplateDraftResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/whatsapp/send-template": {
      "post": {
        "operationId": "sendTemplate",
        "summary": "Send a WhatsApp template",
        "description": "Directly send a WhatsApp template to a contact",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SendTemplateInputDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SendTemplateOutputDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/widget/connections/{connectionId}/access-token": {
      "post": {
        "operationId": "getWidgetConnectionAccessToken",
        "summary": "Retrieve a personal connection access token from your backend",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "contact_id": {
                    "type": "string",
                    "minLength": 1
                  },
                  "account_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  }
                },
                "required": [
                  "contact_id"
                ]
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "connectionId",
            "required": true
          }
        ],
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "connection_id": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                    },
                    "resource": {
                      "type": "string"
                    },
                    "access_token": {
                      "type": "string"
                    },
                    "token_type": {
                      "type": "string",
                      "enum": [
                        "Bearer"
                      ]
                    },
                    "expires_at": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "scope": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "connection_id",
                    "resource",
                    "access_token",
                    "token_type",
                    "expires_at",
                    "scope"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "409": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": [
                        "connection_required"
                      ]
                    }
                  },
                  "required": [
                    "code"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/widget/connections/{serverId}/call": {
      "post": {
        "operationId": "callWidgetConnectionTool",
        "summary": "Use a user connection from your backend",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "contact_id": {
                    "type": "string"
                  },
                  "account_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "tool": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "arguments": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  }
                },
                "required": [
                  "contact_id",
                  "tool",
                  "arguments"
                ]
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "serverId",
            "required": true
          }
        ],
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "number"
                    },
                    {
                      "type": "boolean"
                    },
                    {
                      "type": "null"
                    },
                    {
                      "type": "array",
                      "items": {}
                    },
                    {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": [
                        "connection_required",
                        "provider_connection_required"
                      ]
                    }
                  },
                  "required": [
                    "code"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/widget/authenticate-user": {
      "post": {
        "operationId": "authenticateWidgetUser",
        "summary": "Authenticate a widget user",
        "description": "authenticate the contacts",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AuthenticateUserPayloadDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerifiedWidgetContactTokenResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/widget/authenticate-user-by-phone": {
      "post": {
        "operationId": "authenticateWidgetUserByPhone",
        "summary": "Authenticate a widget user by phone number",
        "description": "Returns a token for the contact with this phone number, creating the contact when none exists and otherwise updating it with the fields sent. When several contacts share the number, the oldest one is used. Email is not accepted: use /widget/authenticate-user for customers with an email.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AuthenticateUserByPhonePayloadDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerifiedWidgetContactTokenResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/widget/authenticate-user-by-external-id": {
      "post": {
        "operationId": "authenticateWidgetUserByExternalId",
        "summary": "Authenticate a widget user by your own user id",
        "description": "Returns a token for the contact with this external_id, creating the contact when none exists and otherwise updating it with the fields sent. The contact is matched by external_id alone: email and phone are optional, can change, and can be shared with other contacts. Channels that identify people by email or phone, such as inbound email, keep their own contacts and never resolve to this one.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AuthenticateUserByExternalIdPayloadDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerifiedWidgetContactTokenResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/test": {
      "get": {
        "operationId": "testConnection",
        "summary": "Test API connection",
        "description": "Validates the API key and returns ok if valid.",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TestConnectionOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/test/phone/simulate-ring": {
      "post": {
        "operationId": "simulatePhoneRing",
        "summary": "Test-only: simulate a phone-call ring",
        "description": "Test-environment-only endpoint that fakes an inbound phone call ring for an existing session. Returns 404 outside of test/dev environments.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SimulatePhoneRingInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SimulatePhoneRingOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/hc": {
      "get": {
        "operationId": "listHelpCenters",
        "summary": "List help centers",
        "description": "List all help centers accessible by this API key.",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListHelpCentersOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/hc/{id}": {
      "get": {
        "operationId": "getHelpCenter",
        "summary": "Get a help center",
        "description": "Read one help center: its name, description, domain, languages, theme, custom CSS and head scripts, and per-language title/description overrides.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiHelpCenterDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "updateHelpCenter",
        "summary": "Update a help center",
        "description": "Change a help center itself: name, description, domain, logo, custom CSS, custom head scripts, sidebar variant, translation prompt, and per-language title/description overrides. Only the fields you send are changed, except localizations, which replace what is stored.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "description": {
                    "type": "string"
                  },
                  "domain": {
                    "type": "string"
                  },
                  "logo_url": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "primary_language_code": {
                    "type": "string"
                  },
                  "translation_prompt": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "custom_css": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "custom_head_scripts": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "sidebar_variant": {
                    "type": "string",
                    "enum": [
                      "sidebar",
                      "floating",
                      "inset"
                    ]
                  },
                  "localizations": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "type": "object",
                      "properties": {
                        "title": {
                          "type": "string"
                        },
                        "description": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      }
                    }
                  },
                  "moves_apply_to_all_languages": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiHelpCenterDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/hc/{id}/languages": {
      "get": {
        "operationId": "getHelpCenterLanguages",
        "summary": "Get the languages a help center serves",
        "description": "The source language every article is written in, the languages the site is served in, and whether translation runs automatically on publish.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "primary_language_code": {
                      "type": "string"
                    },
                    "enabled_languages": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "auto_translate": {
                      "type": "string",
                      "enum": [
                        "on_publish",
                        "off"
                      ],
                      "description": "When automatic translation into the other enabled languages runs: after a source-language publish, or never."
                    }
                  },
                  "required": [
                    "primary_language_code",
                    "enabled_languages",
                    "auto_translate"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "updateHelpCenterLanguages",
        "summary": "Change which languages a help center serves",
        "description": "Set the served languages and whether publishing a source article automatically translates it. `enabled_languages` replaces the list; removing a language stops serving it. The primary language cannot be changed.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "primary_language_code": {
                    "type": "string"
                  },
                  "enabled_languages": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "auto_translate": {
                    "type": "string",
                    "enum": [
                      "on_publish",
                      "off"
                    ],
                    "description": "When automatic translation into the other enabled languages runs: after a source-language publish, or never."
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "primary_language_code": {
                      "type": "string"
                    },
                    "enabled_languages": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "auto_translate": {
                      "type": "string",
                      "enum": [
                        "on_publish",
                        "off"
                      ],
                      "description": "When automatic translation into the other enabled languages runs: after a source-language publish, or never."
                    }
                  },
                  "required": [
                    "primary_language_code",
                    "enabled_languages",
                    "auto_translate"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/hc/{id}/translation-jobs": {
      "get": {
        "operationId": "listHelpCenterTranslationJobs",
        "summary": "List translations still running",
        "description": "Translations that have not finished yet, with the language and article or topic each one is for. Poll this after a publish or a retranslate to know when the other languages have caught up; an empty list means nothing is in flight.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListHelpCenterTranslationJobsOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/hc/{id}/glossary": {
      "get": {
        "operationId": "listHelpCenterGlossaryTerms",
        "summary": "List the translation glossary",
        "description": "Terms the translator must render exactly as defined — product names, feature names, anything that must not be paraphrased.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListHelpCenterGlossaryTermsOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createHelpCenterGlossaryTerm",
        "summary": "Add a glossary term",
        "description": "Add a term the translator must keep as written. Takes effect on the next translation; existing translations are unchanged until retranslated.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateGlossaryTermDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GlossaryTermDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/hc/{id}/glossary/import-from-translation": {
      "post": {
        "operationId": "importHelpCenterGlossaryTerms",
        "summary": "Import glossary terms from the organization glossary",
        "description": "Copy the organization-wide translation glossary into this help center. Terms that already exist here are left alone; the count is how many were added.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImportHelpCenterGlossaryTermsOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/hc/{id}/glossary/{termId}": {
      "put": {
        "operationId": "updateHelpCenterGlossaryTerm",
        "summary": "Update a glossary term",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateGlossaryTermDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "termId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GlossaryTermDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteHelpCenterGlossaryTerm",
        "summary": "Delete a glossary term",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "termId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteHelpCenterGlossaryTermOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/hc/{id}/media": {
      "post": {
        "operationId": "uploadHelpCenterMedia",
        "summary": "Upload media file to help center",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HcMediaUploadResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listHelpCenterMedia",
        "summary": "List help center media files",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListHelpCenterMediaOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/hc/{id}/media/{mediaId}": {
      "delete": {
        "operationId": "deleteHelpCenterMedia",
        "summary": "Delete help center media file",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "mediaId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteHelpCenterMediaOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/hc/{helpCenterId}/categories": {
      "get": {
        "operationId": "listHelpCenterTopics",
        "summary": "List help center topics",
        "description": "List every topic of the help center with its locale for the requested language (primary language when omitted). parent_id is null for top-level topics.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "language_code",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "helpCenterId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CategoryListItemResponseDto"
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createHelpCenterTopic",
        "summary": "Create a help center topic",
        "description": "Create a topic in the primary language. Pass parent_id to create it as a subtopic. Translations for other enabled languages are generated in the background.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1
                  },
                  "slug": {
                    "type": "string"
                  },
                  "description": {
                    "description": "Short blurb shown under the topic name on the help-center home grid.",
                    "type": "string"
                  },
                  "icon": {
                    "description": "Lucide icon name in kebab-case (e.g. 'folder', 'credit-card', 'shopping-cart' — see lucide.dev/icons). Unknown names render no icon.",
                    "type": "string"
                  },
                  "parent_id": {
                    "description": "Create as a subtopic of this topic; omit or null for a top-level topic.",
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "name"
                ]
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "helpCenterId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateCategoryResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/hc/{helpCenterId}/categories/{categoryEntityId}": {
      "get": {
        "operationId": "getHelpCenterTopic",
        "summary": "Get a help center topic",
        "description": "Fetch one topic with all of its locale versions.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "language_code",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "helpCenterId",
            "required": true
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "categoryEntityId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CategoryWithLocalesResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "updateHelpCenterTopic",
        "summary": "Update a help center topic",
        "description": "Update name, description or icon. Writing the primary language re-translates the others; writing another language edits that translation only. Use the structure endpoints to move a topic.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateCategoryInLanguageDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "helpCenterId",
            "required": true
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "categoryEntityId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpdateCategoryInLanguageResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteHelpCenterTopic",
        "summary": "Delete a help center topic",
        "description": "Delete a topic. Pass move_contents_to to re-home its articles and subtopics under another topic first; without it they are deleted with it.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "query",
            "name": "move_contents_to",
            "required": false,
            "description": "Move the topic’s articles and subtopics under this topic (in every language) before deleting it. Without it the topic’s contents are deleted with it."
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "helpCenterId",
            "required": true
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "categoryEntityId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteHelpCenterTopicOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/hc/{helpCenterId}/categories/{categoryEntityId}/restore-deleted": {
      "post": {
        "operationId": "restoreHelpCenterTopic",
        "summary": "Restore a deleted help center topic",
        "description": "Bring a deleted topic back and place it back in the tree. Only works while the topic is still soft-deleted.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "helpCenterId",
            "required": true
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "categoryEntityId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestoreDeletedResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/hc/{helpCenterId}/categories/{categoryEntityId}/retranslate": {
      "post": {
        "operationId": "retranslateHelpCenterTopic",
        "summary": "Retranslate a help center topic into one language",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "language_code": {
                    "type": "string"
                  }
                },
                "required": [
                  "language_code"
                ]
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "helpCenterId",
            "required": true
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "categoryEntityId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "job": {
                      "$ref": "#/components/schemas/TranslationJobResponseDto"
                    }
                  },
                  "required": [
                    "job"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/hc/{helpCenterId}/categories/{categoryEntityId}/retranslate-all": {
      "post": {
        "operationId": "retranslateHelpCenterTopicAll",
        "summary": "Retranslate a help center topic into every enabled language",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "helpCenterId",
            "required": true
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "categoryEntityId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "jobs": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/TranslationJobResponseDto"
                      }
                    }
                  },
                  "required": [
                    "jobs"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/hc/{helpCenterId}/structure/tree": {
      "get": {
        "operationId": "getHelpCenterTree",
        "summary": "Get the help center content tree",
        "description": "The whole tree for one language — nested topics with their articles, in the order they are served. Each article reports whether it has a version, a published version and an unsaved draft.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 2
            },
            "in": "query",
            "name": "language_code",
            "required": true
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "helpCenterId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HelpCenterTreeResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/hc/{helpCenterId}/structure/move-article": {
      "post": {
        "operationId": "moveHelpCenterArticle",
        "summary": "Move an article to a topic",
        "description": "Place the article under category_entity_id at position (0 = first) in the given language’s tree. Other languages keep their own order.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HelpCenterMoveArticleDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "helpCenterId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HelpCenterStructureOkDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/hc/{helpCenterId}/structure/move-topic": {
      "post": {
        "operationId": "moveHelpCenterTopic",
        "summary": "Move a topic under another topic",
        "description": "Place the topic under parent_category_entity_id (null for top level) at position in the given language’s tree. Moving a topic under itself or one of its own subtopics is rejected.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HelpCenterMoveTopicDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "helpCenterId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HelpCenterStructureOkDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/hc/{helpCenterId}/structure/reorder": {
      "post": {
        "operationId": "reorderHelpCenterTree",
        "summary": "Reorder the children of one topic",
        "description": "ordered_ids is the new order of everything directly under parent_category_entity_id (null for the top level), topics and articles alike, in the given language.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HelpCenterReorderDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "helpCenterId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HelpCenterStructureOkDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/hc/{helpCenterId}/articles": {
      "get": {
        "operationId": "listHelpCenterArticles",
        "summary": "List help center articles",
        "description": "List every article of the help center with its locale for the requested language (primary language when omitted).",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "language_code",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "helpCenterId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ArticleListItemResponseDto"
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createHelpCenterArticle",
        "summary": "Create a help center article",
        "description": "Create an article draft in the primary language under the given topic. The article is NOT published until you call the publish endpoint.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePublicArticleDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "helpCenterId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateArticleResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/hc/{helpCenterId}/articles/{entityId}": {
      "get": {
        "operationId": "getHelpCenterArticle",
        "summary": "Get a help center article",
        "description": "Fetch one article with its source version and locale versions.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "language_code",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "helpCenterId",
            "required": true
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "entityId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArticleWithVersionsResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "updateHelpCenterArticle",
        "summary": "Update a help center article",
        "description": "Create a new draft version with the given title/content (source language unless language_code says otherwise). Publish it via the publish endpoint.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EditArticleDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "helpCenterId",
            "required": true
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "entityId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EditArticleResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteHelpCenterArticle",
        "summary": "Delete a help center article",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "helpCenterId",
            "required": true
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "entityId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteHelpCenterArticleOutput"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/hc/{helpCenterId}/articles/{entityId}/backlinks": {
      "get": {
        "operationId": "listHelpCenterArticleBacklinks",
        "summary": "List the articles that link to a help center article",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "language_code",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "helpCenterId",
            "required": true
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "entityId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArticleBacklinksResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/hc/{helpCenterId}/articles/{entityId}/versions": {
      "get": {
        "operationId": "listHelpCenterArticleVersions",
        "summary": "List versions of a help center article",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "language_code",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "helpCenterId",
            "required": true
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "entityId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArticleVersionsResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/hc/{helpCenterId}/articles/{entityId}/publish": {
      "post": {
        "operationId": "publishHelpCenterArticle",
        "summary": "Publish a help center article (all locales)",
        "description": "Publish the article in every language it has, shipping the newest stored version. An unsaved draft an author has open in the dashboard editor is never picked up.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "source_version_id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "helpCenterId",
            "required": true
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "entityId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "sourceVersion": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                        },
                        "entity_id": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                        },
                        "version_number": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "content_html": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "meta_title": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "meta_description": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "generated_from_session_id": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "created_at": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "is_active": {
                          "anyOf": [
                            {
                              "type": "boolean"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "entity_id",
                        "version_number",
                        "content_html",
                        "meta_title",
                        "meta_description",
                        "generated_from_session_id",
                        "created_at",
                        "is_active"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "sourceVersion"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/hc/{helpCenterId}/articles/{entityId}/locales/{languageCode}/publish": {
      "post": {
        "operationId": "publishHelpCenterArticleLocale",
        "summary": "Publish one locale of a help center article",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "locale_version_id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "helpCenterId",
            "required": true
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "entityId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "languageCode",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "locale": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                        },
                        "source_version_id": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                        },
                        "entity_id": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                        },
                        "help_center_id": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                        },
                        "language_code": {
                          "type": "string"
                        },
                        "title": {
                          "type": "string"
                        },
                        "slug": {
                          "type": "string"
                        },
                        "content_html": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "is_manual": {
                          "anyOf": [
                            {
                              "type": "boolean"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "translated_from_locale_version_id": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "created_at": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "is_published": {
                          "anyOf": [
                            {
                              "type": "boolean"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "published_at": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "date-time"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "source_version_id",
                        "entity_id",
                        "help_center_id",
                        "language_code",
                        "title",
                        "slug",
                        "content_html",
                        "is_manual",
                        "translated_from_locale_version_id",
                        "created_at",
                        "is_published",
                        "published_at"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "locale"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/hc/{helpCenterId}/articles/{entityId}/unpublish": {
      "post": {
        "operationId": "unpublishHelpCenterArticle",
        "summary": "Unpublish a help center article",
        "description": "Unpublish one locale when language_code is given, otherwise every locale. Unpublishing the primary locale also hides the article from the AI assistant.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "language_code": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "helpCenterId",
            "required": true
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "entityId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "locales": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                          },
                          "source_version_id": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                          },
                          "entity_id": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                          },
                          "help_center_id": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                          },
                          "language_code": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          },
                          "slug": {
                            "type": "string"
                          },
                          "content_html": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "is_manual": {
                            "anyOf": [
                              {
                                "type": "boolean"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "translated_from_locale_version_id": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "uuid",
                                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "is_published": {
                            "anyOf": [
                              {
                                "type": "boolean"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "published_at": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "source_version_id",
                          "entity_id",
                          "help_center_id",
                          "language_code",
                          "title",
                          "slug",
                          "content_html",
                          "is_manual",
                          "translated_from_locale_version_id",
                          "created_at",
                          "is_published",
                          "published_at"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "locales"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/hc/{helpCenterId}/articles/{entityId}/restore-deleted": {
      "post": {
        "operationId": "restoreHelpCenterArticle",
        "summary": "Restore a deleted help center article",
        "description": "Bring a deleted article back with its content and place it back in the tree. Only works while the article is still soft-deleted.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "helpCenterId",
            "required": true
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "entityId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestoreDeletedResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/hc/{helpCenterId}/articles/{entityId}/language-states": {
      "get": {
        "operationId": "getHelpCenterArticleLanguageStates",
        "summary": "Get the per-language state of a help center article",
        "description": "For each language: whether it is published, whether it has unpublished changes, and whether its translation is behind the source. Read this before publishing to know what will change.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "helpCenterId",
            "required": true
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "entityId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArticleLanguageStatesDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/hc/{helpCenterId}/articles/{entityId}/retranslate": {
      "post": {
        "operationId": "retranslateHelpCenterArticle",
        "summary": "Retranslate a help center article into one language",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "language_code": {
                    "type": "string"
                  }
                },
                "required": [
                  "language_code"
                ]
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "query",
            "name": "source_version_id",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "helpCenterId",
            "required": true
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "entityId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "job": {
                      "$ref": "#/components/schemas/TranslationJobResponseDto"
                    }
                  },
                  "required": [
                    "job"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/hc/{helpCenterId}/articles/{entityId}/retranslate-all": {
      "post": {
        "operationId": "retranslateHelpCenterArticleAll",
        "summary": "Retranslate a help center article into every enabled language",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "query",
            "name": "source_version_id",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "helpCenterId",
            "required": true
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "entityId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "jobs": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/TranslationJobResponseDto"
                      }
                    }
                  },
                  "required": [
                    "jobs"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/media/upload": {
      "post": {
        "summary": "Upload an image",
        "description": "Upload an image to your organization storage. Useful for training content, help center, and other rich-text fields.\n\n**Request body:** `multipart/form-data` with one part named `file`. Use a filename and `Content-Type` that match the image (PNG, JPEG, GIF, or WebP).\n\n**Limits:** 5 MB maximum. Bytes are checked against the declared type (magic-byte validation).",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/FileUploadDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MediaUploadResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MediaPublicErrorResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MediaPublicErrorResponseDto"
                }
              }
            }
          },
          "403": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MediaPublicErrorResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/sla/policies": {
      "get": {
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                          },
                          "org_id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "office_hours_id": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "uuid",
                                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "first_reply_target_seconds": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "next_reply_target_seconds": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "resolution_target_seconds": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "answer_target_seconds": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "answer_target_percent": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "answer_count_mode": {
                            "type": "string",
                            "enum": [
                              "all_offered",
                              "answered_only"
                            ]
                          },
                          "answer_short_abandon_seconds": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "created_at": {
                            "type": "string"
                          },
                          "updated_at": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "org_id",
                          "name",
                          "office_hours_id",
                          "first_reply_target_seconds",
                          "next_reply_target_seconds",
                          "resolution_target_seconds",
                          "answer_target_seconds",
                          "answer_target_percent",
                          "answer_count_mode",
                          "answer_short_abandon_seconds",
                          "created_at",
                          "updated_at"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "post": {
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSlaPolicyDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                        },
                        "org_id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "office_hours_id": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "first_reply_target_seconds": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "next_reply_target_seconds": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "resolution_target_seconds": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "answer_target_seconds": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "answer_target_percent": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "answer_count_mode": {
                          "type": "string",
                          "enum": [
                            "all_offered",
                            "answered_only"
                          ]
                        },
                        "answer_short_abandon_seconds": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "created_at": {
                          "type": "string"
                        },
                        "updated_at": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "org_id",
                        "name",
                        "office_hours_id",
                        "first_reply_target_seconds",
                        "next_reply_target_seconds",
                        "resolution_target_seconds",
                        "answer_target_seconds",
                        "answer_target_percent",
                        "answer_count_mode",
                        "answer_short_abandon_seconds",
                        "created_at",
                        "updated_at"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/sla/policies/{id}": {
      "get": {
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                        },
                        "org_id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "office_hours_id": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "first_reply_target_seconds": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "next_reply_target_seconds": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "resolution_target_seconds": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "answer_target_seconds": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "answer_target_percent": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "answer_count_mode": {
                          "type": "string",
                          "enum": [
                            "all_offered",
                            "answered_only"
                          ]
                        },
                        "answer_short_abandon_seconds": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "created_at": {
                          "type": "string"
                        },
                        "updated_at": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "org_id",
                        "name",
                        "office_hours_id",
                        "first_reply_target_seconds",
                        "next_reply_target_seconds",
                        "resolution_target_seconds",
                        "answer_target_seconds",
                        "answer_target_percent",
                        "answer_count_mode",
                        "answer_short_abandon_seconds",
                        "created_at",
                        "updated_at"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "put": {
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSlaPolicyDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                        },
                        "org_id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "office_hours_id": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "first_reply_target_seconds": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "next_reply_target_seconds": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "resolution_target_seconds": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "answer_target_seconds": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "answer_target_percent": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "answer_count_mode": {
                          "type": "string",
                          "enum": [
                            "all_offered",
                            "answered_only"
                          ]
                        },
                        "answer_short_abandon_seconds": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "created_at": {
                          "type": "string"
                        },
                        "updated_at": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "org_id",
                        "name",
                        "office_hours_id",
                        "first_reply_target_seconds",
                        "next_reply_target_seconds",
                        "resolution_target_seconds",
                        "answer_target_seconds",
                        "answer_target_percent",
                        "answer_count_mode",
                        "answer_short_abandon_seconds",
                        "created_at",
                        "updated_at"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "delete": {
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response"
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/sla/analytics": {
      "get": {
        "operationId": "getSlaAnalyticsOverview",
        "summary": "Get SLA analytics overview",
        "description": "Get SLA compliance rates, coverage rate, and response/resolution time percentiles for a date range. Reports may briefly lag recent changes; historical ranges have no fixed maximum span. Oversized, busy, or unavailable reports return explicit errors.",
        "parameters": [
          {
            "schema": {},
            "in": "query",
            "name": "from",
            "required": true
          },
          {
            "schema": {},
            "in": "query",
            "name": "to",
            "required": true
          },
          {
            "schema": {
              "default": "UTC",
              "type": "string"
            },
            "in": "query",
            "name": "timezone",
            "required": false
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "policy_id",
            "required": false
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "team_id",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "web",
                "email",
                "phone_voice",
                "slack",
                "sms",
                "whatsapp",
                "instagram",
                "messenger",
                "api",
                "web_voice",
                "twitter",
                "twitter_mentions",
                "app_review",
                "internal"
              ]
            },
            "in": "query",
            "name": "channel",
            "required": false
          },
          {
            "schema": {
              "type": "number"
            },
            "in": "query",
            "name": "agent_id",
            "required": false
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SlaOverviewResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/sla/analytics/breakdown": {
      "get": {
        "operationId": "getSlaAnalyticsBreakdown",
        "summary": "Get SLA analytics breakdown",
        "description": "Get SLA compliance rates grouped by policy, team, agent, or channel.",
        "parameters": [
          {
            "schema": {},
            "in": "query",
            "name": "from",
            "required": true
          },
          {
            "schema": {},
            "in": "query",
            "name": "to",
            "required": true
          },
          {
            "schema": {
              "default": "UTC",
              "type": "string"
            },
            "in": "query",
            "name": "timezone",
            "required": false
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "policy_id",
            "required": false
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "team_id",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "web",
                "email",
                "phone_voice",
                "slack",
                "sms",
                "whatsapp",
                "instagram",
                "messenger",
                "api",
                "web_voice",
                "twitter",
                "twitter_mentions",
                "app_review",
                "internal"
              ]
            },
            "in": "query",
            "name": "channel",
            "required": false
          },
          {
            "schema": {
              "type": "number"
            },
            "in": "query",
            "name": "agent_id",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "policy",
                "team",
                "agent",
                "channel"
              ]
            },
            "in": "query",
            "name": "group_by",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SlaBreakdownResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/sla/analytics/trend": {
      "get": {
        "operationId": "getSlaAnalyticsTrend",
        "summary": "Get SLA analytics trend",
        "description": "Get SLA compliance rates over time, grouped by day or week.",
        "parameters": [
          {
            "schema": {},
            "in": "query",
            "name": "from",
            "required": true
          },
          {
            "schema": {},
            "in": "query",
            "name": "to",
            "required": true
          },
          {
            "schema": {
              "default": "UTC",
              "type": "string"
            },
            "in": "query",
            "name": "timezone",
            "required": false
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "policy_id",
            "required": false
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "team_id",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "web",
                "email",
                "phone_voice",
                "slack",
                "sms",
                "whatsapp",
                "instagram",
                "messenger",
                "api",
                "web_voice",
                "twitter",
                "twitter_mentions",
                "app_review",
                "internal"
              ]
            },
            "in": "query",
            "name": "channel",
            "required": false
          },
          {
            "schema": {
              "type": "number"
            },
            "in": "query",
            "name": "agent_id",
            "required": false
          },
          {
            "schema": {
              "default": "day",
              "type": "string",
              "enum": [
                "day",
                "week"
              ]
            },
            "in": "query",
            "name": "granularity",
            "required": false
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SlaTrendResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/sla/analytics/breach-heatmap": {
      "get": {
        "operationId": "getSlaBreachHeatmap",
        "summary": "Get SLA breach heatmap",
        "description": "Get a heatmap of SLA breaches by hour of day and day of week.",
        "parameters": [
          {
            "schema": {},
            "in": "query",
            "name": "from",
            "required": true
          },
          {
            "schema": {},
            "in": "query",
            "name": "to",
            "required": true
          },
          {
            "schema": {
              "default": "UTC",
              "type": "string"
            },
            "in": "query",
            "name": "timezone",
            "required": false
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "policy_id",
            "required": false
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "team_id",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "web",
                "email",
                "phone_voice",
                "slack",
                "sms",
                "whatsapp",
                "instagram",
                "messenger",
                "api",
                "web_voice",
                "twitter",
                "twitter_mentions",
                "app_review",
                "internal"
              ]
            },
            "in": "query",
            "name": "channel",
            "required": false
          },
          {
            "schema": {
              "type": "number"
            },
            "in": "query",
            "name": "agent_id",
            "required": false
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SlaBreachHeatmapResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/sla/analytics/phone": {
      "get": {
        "operationId": "getPhoneAnswerAnalyticsOverview",
        "summary": "Get phone answer-time analytics",
        "description": "Get how quickly callers waiting for an agent were answered: answer-time compliance, outcomes (answered, hung up, timed out, no agents, voicemail) and answer-time percentiles for a date range.",
        "parameters": [
          {
            "schema": {},
            "in": "query",
            "name": "from",
            "required": true,
            "description": "Start of the range, on when callers started waiting."
          },
          {
            "schema": {},
            "in": "query",
            "name": "to",
            "required": true,
            "description": "End of the range, on when callers started waiting."
          },
          {
            "schema": {
              "default": "UTC",
              "type": "string"
            },
            "in": "query",
            "name": "timezone",
            "required": false,
            "description": "IANA timezone for day and hour buckets."
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 36
            },
            "in": "query",
            "name": "team_id",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "query",
            "name": "policy_id",
            "required": false
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PhoneAnswerOverviewResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/sla/analytics/phone/breakdown": {
      "get": {
        "operationId": "getPhoneAnswerAnalyticsBreakdown",
        "summary": "Get phone answer-time analytics breakdown",
        "description": "Get phone answer-time compliance and outcomes grouped by team, policy, day, or hour of day.",
        "parameters": [
          {
            "schema": {},
            "in": "query",
            "name": "from",
            "required": true,
            "description": "Start of the range, on when callers started waiting."
          },
          {
            "schema": {},
            "in": "query",
            "name": "to",
            "required": true,
            "description": "End of the range, on when callers started waiting."
          },
          {
            "schema": {
              "default": "UTC",
              "type": "string"
            },
            "in": "query",
            "name": "timezone",
            "required": false,
            "description": "IANA timezone for day and hour buckets."
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 36
            },
            "in": "query",
            "name": "team_id",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "query",
            "name": "policy_id",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "team",
                "policy",
                "day",
                "hour"
              ]
            },
            "in": "query",
            "name": "group_by",
            "required": true,
            "description": "day = calendar day, hour = hour of day (0–23) across the whole range, both in `timezone`."
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PhoneAnswerBreakdownResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/sla/analytics/phone/agents": {
      "get": {
        "operationId": "getPhoneAnswerAnalyticsAgents",
        "summary": "Get phone answer analytics per agent",
        "description": "Get each agent's rings: how many they were offered, answered, declined and missed, their answer rate and how quickly they answered once rung.",
        "parameters": [
          {
            "schema": {},
            "in": "query",
            "name": "from",
            "required": true,
            "description": "Start of the range, on when callers started waiting."
          },
          {
            "schema": {},
            "in": "query",
            "name": "to",
            "required": true,
            "description": "End of the range, on when callers started waiting."
          },
          {
            "schema": {
              "default": "UTC",
              "type": "string"
            },
            "in": "query",
            "name": "timezone",
            "required": false,
            "description": "IANA timezone for day and hour buckets."
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 36
            },
            "in": "query",
            "name": "team_id",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "query",
            "name": "policy_id",
            "required": false
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PhoneAnswerAgentsResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/reports/query": {
      "post": {
        "operationId": "runReportQuery",
        "summary": "DEPRECATED — use runAnalyticsQuery",
        "description": "DEPRECATED: legacy Postgres-backed report queries. Existing published mini apps keep working, but new code must use `runAnalyticsQuery` (ClickHouse-backed `report_*` views). Run a read-only SQL query against the org-scoped `report_*_view` views. Scoped to the calling organization and read-only, enforced server-side.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RunReportQueryBody"
              }
            }
          }
        },
        "deprecated": true,
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RunReportQueryResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/reports/analytics": {
      "post": {
        "operationId": "runAnalyticsQuery",
        "summary": "Run a read-only analytics query",
        "description": "Run a read-only SQL query against the org-scoped `report_*` analytics views. Scoped to the calling organization and read-only, enforced server-side.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RunReportQueryBody"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RunReportQueryResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/partner-analytics/orgs": {
      "get": {
        "operationId": "listPartnerOrgs",
        "summary": "List the connected orgs of the calling partner admin org",
        "description": "The partner's connected organizations — the scope of every `runPartnerAnalyticsQuery` and the org dimension (id → name) to join `report_partner_*` rows to. Only available to partner admin organizations (403 otherwise).",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListPartnerOrgsResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/partner-analytics/orgs/search": {
      "get": {
        "operationId": "searchPartnerOrgs",
        "summary": "Search connected orgs with health signals (paginated)",
        "description": "Find, filter, sort and page through the calling partner's connected orgs (its customers), each with the health signals the Partner Admin console shows: `health.status` — `new` (connected < 7 days, no sessions yet), `setup_incomplete` (no knowledge sources and no actions), `inactive` (no session in the last 30 days), `healthy` (everything else) — plus `members`, `data_sources`, `has_ai_training`, `has_actions`, `sessions_30d`, `total_sessions`, `last_session_at`, and per-channel connected flags (`chat`, `email`, `whatsapp`, `instagram`, `messenger`, `sms`, `voice`). `q` matches name or external_id; `status`, `tags`, `channels` and `addons` are comma-separated (tags match ANY, channels and add-ons match ALL; add-ons are `fareharbor`, `shopify`, `jira`); `has_ai` / `has_actions` are 'true' / 'false'; `archived=only` lists the partner's archived orgs, which are hidden unless asked for. Max 100 rows per page (`limit`/`offset`); `total` is the filtered count. For volume, quality and behaviour beyond these signals use `runPartnerAnalyticsQuery`; for the full id → name roster use `listPartnerOrgs`. Only available to partner admin organizations (403 otherwise).",
        "parameters": [
          {
            "schema": {
              "default": 50,
              "type": "number",
              "minimum": 1,
              "maximum": 100
            },
            "in": "query",
            "name": "limit",
            "required": false
          },
          {
            "schema": {
              "default": 0,
              "type": "number",
              "minimum": 0
            },
            "in": "query",
            "name": "offset",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "in": "query",
            "name": "q",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "in": "query",
            "name": "status",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            },
            "in": "query",
            "name": "has_ai",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            },
            "in": "query",
            "name": "has_actions",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 1000
            },
            "in": "query",
            "name": "tags",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 100
            },
            "in": "query",
            "name": "channels",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 100
            },
            "in": "query",
            "name": "addons",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "only"
              ]
            },
            "in": "query",
            "name": "archived",
            "required": false
          },
          {
            "schema": {
              "default": "created_at",
              "type": "string",
              "enum": [
                "created_at",
                "name",
                "members",
                "data_sources",
                "sessions_30d",
                "total_sessions",
                "last_session_at"
              ]
            },
            "in": "query",
            "name": "sort_by",
            "required": false
          },
          {
            "schema": {
              "default": "desc",
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ]
            },
            "in": "query",
            "name": "sort_dir",
            "required": false
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchPartnerOrgsResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/partner-analytics/query": {
      "post": {
        "operationId": "runPartnerAnalyticsQuery",
        "summary": "Run a read-only analytics query across the partner’s connected orgs",
        "description": "Run a read-only SQL query against the partner-scoped `report_partner_*` analytics views (the same columns as the org `report_*` views, plus `org_id`), covering every org connected to the calling partner admin org. Read-only and scoped server-side; only available to partner admin organizations (403 otherwise).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RunReportQueryBody"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RunReportQueryResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/salesforce/miaw/webhook": {
      "post": {
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SalesforceMiawWebhookBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SalesforceMiawWebhookResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/salesforce-crm/connection/status": {
      "get": {
        "operationId": "getSalesforceCrmConnectionStatus",
        "summary": "Get Salesforce CRM connection status",
        "description": "Whether the organization has an active Salesforce CRM connection. Probe this before rendering any Salesforce-backed surface; 404 means the organization never connected.",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SalesforceCrmConnectionStatusDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/salesforce-crm/contacts/{contactId}": {
      "get": {
        "operationId": "getSalesforceCrmContact",
        "summary": "Get a contact's Salesforce CRM panel",
        "description": "The full Salesforce view of one OpenCX contact: the matched Contact or Lead, its account, opportunities, past cases, and the organization's configured custom objects. `lookup_status` distinguishes a confirmed no-match (`none`) from Salesforce being unreachable (`failed`) — treat `failed` as unknown, never as absence.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "contactId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConsumerSalesforceCrmContactResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/salesforce-crm/contacts": {
      "get": {
        "operationId": "listSalesforceCrmContacts",
        "summary": "List cached Salesforce CRM records",
        "description": "The synced Salesforce Contacts and Leads the organization has cached, newest first. Served from the cache — this never queries Salesforce.",
        "parameters": [
          {
            "schema": {
              "default": 1,
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "in": "query",
            "name": "page",
            "required": false
          },
          {
            "schema": {
              "default": 10,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "in": "query",
            "name": "limit",
            "required": false
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedSalesforceCrmContactsResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/salesforce-crm/contacts/search": {
      "get": {
        "operationId": "searchSalesforceCrmContacts",
        "summary": "Search cached Salesforce CRM records",
        "description": "Match cached Salesforce records by exact email and/or phone (both given means both must match). Served from the cache — this never queries Salesforce. At least one of `email` or `phone` is required.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "email",
              "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
            },
            "in": "query",
            "name": "email",
            "required": false
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "phone",
            "required": false
          },
          {
            "schema": {
              "default": 1,
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "in": "query",
            "name": "page",
            "required": false
          },
          {
            "schema": {
              "default": 10,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "in": "query",
            "name": "limit",
            "required": false
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedSalesforceCrmContactsResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/salesforce/ai-reply-templates": {
      "get": {
        "operationId": "listSalesforceAiReplyTemplates",
        "summary": "List AI reply templates",
        "description": "List the AI agent's reply templates for the organization (Salesforce v2 integration only): greeting/signature HTML rendered around or below the AI's autopilot Case emails, with one default and optional per-session auto-selection rules.",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SalesforceAiReplyTemplatesListDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createSalesforceAiReplyTemplate",
        "summary": "Create an AI reply template",
        "description": "Create a reply template (Salesforce v2 integration only). The organization's first template becomes the default automatically; `is_default: true` on a later one moves the default atomically. Template HTML. Put {{content}} where the AI agent's reply goes (anything above is the greeting, anything below the signature); without it the template is appended below the reply. Variables: system objects {{contact.full_name}} / {{contact.first_name}} / {{contact.email}} / {{session.number}} / {{session.language}} / {{org.name}} (HTML-escaped) and any session attribute such as {{sf_case_Regards__c}} (inserted raw — Salesforce formula fields hold HTML fragments — then sanitized). {{#if sf_case_Language__c == \"de\"}}…{{else}}…{{/if}} conditions are supported. Scripts, handlers and non-https images are stripped; {{content}} may appear at most once. Optional `rules` (ANDed attribute/tag conditions) make the template pick itself for matching sessions; the first matching rule-bearing template in creation order wins, otherwise the default. Optional `from_address` / `to_address` set the From and To of the autopilot email per session: a literal address, a {{session attribute}} (e.g. {{sf_case_LatestPOSEmail__c}} as From, {{reservation_email}} as To) or an {{#if …}} branch. Each is used only when it resolves to an email address on that session; otherwise the From stays Salesforce's default sender and the To stays the Case contact. A literal that is not an email address is rejected with 400. Combine with `rules` to use different addresses for different sessions.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSalesforceAiReplyTemplateDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SalesforceAiReplyTemplateDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/salesforce/ai-reply-templates/{id}": {
      "patch": {
        "operationId": "updateSalesforceAiReplyTemplate",
        "summary": "Update an AI reply template",
        "description": "Partially update a reply template: name, template_html, is_default (true moves the default onto it), rules (null clears them), from_address / to_address (null clears them). Template HTML. Put {{content}} where the AI agent's reply goes (anything above is the greeting, anything below the signature); without it the template is appended below the reply. Variables: system objects {{contact.full_name}} / {{contact.first_name}} / {{contact.email}} / {{session.number}} / {{session.language}} / {{org.name}} (HTML-escaped) and any session attribute such as {{sf_case_Regards__c}} (inserted raw — Salesforce formula fields hold HTML fragments — then sanitized). {{#if sf_case_Language__c == \"de\"}}…{{else}}…{{/if}} conditions are supported. Scripts, handlers and non-https images are stripped; {{content}} may appear at most once. Optional `from_address` / `to_address` set the From and To of the autopilot email per session: a literal address, a {{session attribute}} (e.g. {{sf_case_LatestPOSEmail__c}} as From, {{reservation_email}} as To) or an {{#if …}} branch. Each is used only when it resolves to an email address on that session; otherwise the From stays Salesforce's default sender and the To stays the Case contact. A literal that is not an email address is rejected with 400. Combine with `rules` to use different addresses for different sessions.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSalesforceAiReplyTemplateDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "Template ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SalesforceAiReplyTemplateDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteSalesforceAiReplyTemplate",
        "summary": "Delete an AI reply template",
        "description": "Permanently delete a reply template. Deleting the default leaves the organization without one (the AI replies plain) until another template is made default.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "Template ID"
          }
        ],
        "responses": {
          "204": {
            "description": "Default Response"
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/salesforce/ai-reply-templates/preview": {
      "post": {
        "operationId": "previewSalesforceAiReplyTemplate",
        "summary": "Preview an AI reply template",
        "description": "Render a template (saved or not) exactly as the AI agent would send it, against a real session of the organization: the session with `session_number`, else the most recent Salesforce-linked session, else an empty context. Returns the rendered HTML and text, the session used, the variables that came out empty, and — when `from_address` / `to_address` are passed — the From and To the AI would use on that session (null = the default applies). Requires the write scope because it resolves real contact data.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PreviewSalesforceAiReplyTemplateDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SalesforceAiReplyTemplatePreviewDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/companion/notify-team": {
      "post": {
        "operationId": "coworkerNotifyTeam",
        "summary": "Notify the team about a coworker escalation",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CoworkerNotifyTeamInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response"
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/companion/sessions/{id}": {
      "get": {
        "operationId": "getCoworkerSessionEvents",
        "summary": "Get coworker session events",
        "description": "Get parsed conversation events for a coworker session. Only available via coworker ephemeral tokens.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response"
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/companion/sessions/{sessionId}/todos": {
      "get": {
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "sessionId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CoworkerTodosResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "put": {
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetCoworkerTodosDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "sessionId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CoworkerTodosResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      },
      "patch": {
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateCoworkerTodoDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "sessionId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CoworkerTodosResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/companion/onboarding": {
      "patch": {
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchOnboardingDto"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "Default Response"
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/mini-apps": {
      "post": {
        "operationId": "createMiniApp",
        "summary": "Create a new mini app",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateMiniAppDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateMiniAppResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/mini-apps/submit": {
      "post": {
        "operationId": "submitMiniApp",
        "summary": "Submit a built version of a mini app",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SubmitMiniAppDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubmitMiniAppResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/mini-apps/{id}": {
      "patch": {
        "operationId": "updateMiniAppDetails",
        "summary": "Update a mini app's name, description, or icon",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateMiniAppDetailsDto"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpdateMiniAppDetailsResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    },
    "/mini-apps/{id}/source": {
      "get": {
        "operationId": "getMiniAppSource",
        "summary": "Get a mini app's latest source for editing",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MiniAppSourceResponseDto"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDto"
                }
              }
            }
          }
        }
      }
    }
  },
  "servers": [
    {
      "url": "http://localhost:8080",
      "description": "Development"
    },
    {
      "url": "https://api.open.cx",
      "description": "Production"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ]
}
