{
  "openapi": "3.1.0",
  "info": {
    "title": "Public API v1",
    "description": "Public API v1 requiring API keys.\n\n**Timestamps:** All datetime fields in API responses are returned in UTC using ISO 8601 format (e.g., `2024-01-15T14:30:00Z`). When filtering by date parameters, provide timestamps in ISO 8601 format.",
    "version": "0.1.0"
  },
  "servers": [
    {
      "url": "https://api.usesimple.ai/api/v1",
      "description": "Production API Server"
    }
  ],
  "paths": {
    "/journeys/{key}/enrollments": {
      "post": {
        "tags": [
          "Journeys"
        ],
        "summary": "Enroll a Contact in a Journey",
        "description": "Enroll a contact in an active journey. Re-sending the same idempotencyKey returns the existing enrollment instead of creating a second one. A contact the journey cannot take is returned with status skipped and the reason.",
        "operationId": "enroll_contact_journeys_key_enrollments_post",
        "security": [
          {
            "APIKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "required": true,
            "description": "The journey's key, such as `appointment-confirmations`. It is shown on the journey's Enrollment tab.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JourneyEnrollRequest"
              },
              "example": {
                "idempotencyKey": "appt-APPT02984416",
                "contact": {
                  "phoneNumber": "+14155550100",
                  "name": "Dana Reyes"
                },
                "subject": {
                  "appointment_number": "APPT02984416",
                  "status": "Scheduled"
                },
                "params": {
                  "store_name": "Market Street"
                },
                "anchorAt": "2026-10-22T14:00:00-04:00"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The enrollment already existed for this idempotencyKey, or the contact was skipped.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JourneyEnrollmentResult"
                }
              }
            }
          },
          "201": {
            "description": "A new enrollment was created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JourneyEnrollmentResult"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiError"
                }
              }
            }
          },
          "404": {
            "description": "No journey with this key, or the contact was not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiError"
                }
              }
            }
          },
          "422": {
            "description": "The request is invalid, or the journey is not active (a draft, paused or archived).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiError"
                }
              }
            }
          }
        }
      }
    },
    "/journeys/{key}/enrollments/cancel": {
      "post": {
        "tags": [
          "Journeys"
        ],
        "summary": "Cancel a Journey Enrollment",
        "description": "End an enrollment by the idempotencyKey it was created with or by its externalId. Every active enrollment carrying the external id ends. The enrollment ends with reason cancelled.",
        "operationId": "cancel_enrollment_journeys_key_enrollments_cancel_post",
        "security": [
          {
            "APIKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "required": true,
            "description": "The journey's key, such as `appointment-confirmations`. It is shown on the journey's Enrollment tab.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JourneyCancelRequest"
              },
              "example": {
                "idempotencyKey": "appt-APPT02984416",
                "reason": "Appointment cancelled in Salesforce"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The enrollment ended, or had already ended.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JourneyEnrollmentResult"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiError"
                }
              }
            }
          },
          "404": {
            "description": "No journey with this key, or no enrollment with this key or external id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiError"
                }
              }
            }
          },
          "422": {
            "description": "Send exactly one of idempotencyKey or externalId.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicApiError"
                }
              }
            }
          }
        }
      }
    },
    "/external_calls/upload_url": {
      "post": {
        "tags": ["External Calls"],
        "summary": "Request External Call Upload URL",
        "description": "Create a short-lived, organization-scoped presigned URL for uploading an external call recording. Upload the audio with an HTTP PUT using the same Content-Type, then pass the returned object_key to POST /external_calls.",
        "operationId": "request_external_call_upload_url",
        "security": [{ "APIKeyHeader": [] }],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/ExternalCallUploadRequest" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Upload URL created",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ExternalCallUploadResponse" }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/HTTPValidationError" }
              }
            }
          }
        }
      }
    },
    "/external_calls": {
      "get": {
        "tags": ["External Calls"],
        "summary": "List External Calls",
        "description": "List external calls associated with the API key's account. Each result represents one call session and may contain one or more recording legs.",
        "operationId": "list_external_calls",
        "security": [{ "APIKeyHeader": [] }],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": { "type": "integer", "minimum": 1, "default": 1 }
          },
          {
            "name": "page_size",
            "in": "query",
            "required": false,
            "schema": { "type": "integer", "minimum": 1, "maximum": 100, "default": 20 }
          },
          {
            "name": "source_id",
            "in": "query",
            "required": false,
            "schema": { "type": "string", "format": "uuid" }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": { "type": "string", "enum": ["processing", "transcribed", "error"] }
          },
          {
            "name": "created_at_gte",
            "in": "query",
            "required": false,
            "description": "Return calls that started at or after this ISO 8601 timestamp.",
            "schema": { "type": "string", "format": "date-time" }
          },
          {
            "name": "created_at_lte",
            "in": "query",
            "required": false,
            "description": "Return calls that started at or before this ISO 8601 timestamp.",
            "schema": { "type": "string", "format": "date-time" }
          },
          {
            "name": "updated_at_gte",
            "in": "query",
            "required": false,
            "description": "Return calls last updated at or after this ISO 8601 timestamp (inclusive).",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "updated_at_lte",
            "in": "query",
            "required": false,
            "description": "Return calls last updated at or before this ISO 8601 timestamp (inclusive).",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "External calls returned",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ExternalCallListResponse" }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/HTTPValidationError" }
              }
            }
          }
        }
      },
      "post": {
        "tags": ["External Calls"],
        "summary": "Create External Call",
        "description": "Confirm a recording uploaded with the external-call upload URL and create a new external call. Transcription and analysis continue asynchronously.",
        "operationId": "create_external_call",
        "security": [{ "APIKeyHeader": [] }],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/CreateExternalCallRequest" }
            }
          }
        },
        "responses": {
          "201": {
            "description": "External call created",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ExternalCallCreateResponse" }
              }
            }
          },
          "404": {
            "description": "Uploaded object not found",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/HTTPValidationError" }
              }
            }
          }
        }
      }
    },
    "/external_calls/{uuid}": {
      "get": {
        "tags": ["External Calls"],
        "summary": "Get External Call",
        "description": "Fetch one external call and its visible recording legs, transcripts, and summaries.",
        "operationId": "get_external_call",
        "security": [{ "APIKeyHeader": [] }],
        "parameters": [
          {
            "name": "uuid",
            "in": "path",
            "required": true,
            "schema": { "type": "string", "format": "uuid" }
          }
        ],
        "responses": {
          "200": {
            "description": "External call returned",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ExternalCallDetails" }
              }
            }
          },
          "404": {
            "description": "External call not found",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/HTTPValidationError" }
              }
            }
          }
        }
      }
    },
    "/feedback/{uuid}/resolve": {
      "post": {
        "tags": [
          "Feedback"
        ],
        "summary": "Resolve Feedback",
        "description": "Mark a feedback entry as fixed, or reopen it. Equivalent to the dashboard's \"Mark as fixed\" control.",
        "operationId": "resolve_feedback_feedback__uuid__resolve_post",
        "security": [
          {
            "APIKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "uuid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "UUID"
            },
            "description": "The UUID of the feedback entry"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "resolved"
                ],
                "properties": {
                  "resolved": {
                    "type": "boolean",
                    "title": "Resolved",
                    "description": "true marks the feedback as fixed; false reopens it"
                  },
                  "note": {
                    "type": "string",
                    "title": "Note",
                    "description": "Optional note to attach alongside the resolution change; the note author is recorded as 'API'"
                  }
                },
                "title": "Resolve Feedback Request"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "feedback"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "title": "Success"
                    },
                    "feedback": {
                      "$ref": "#/components/schemas/UtteranceFeedbackResponse"
                    }
                  },
                  "title": "Resolve Feedback Response"
                }
              }
            }
          },
          "404": {
            "description": "Feedback not found"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/feedback/{uuid}/notes": {
      "post": {
        "tags": [
          "Feedback"
        ],
        "summary": "Add Feedback Note",
        "description": "Attach a note to a feedback entry without changing whether it is resolved. Equivalent to adding a note in the dashboard.",
        "operationId": "add_feedback_note_feedback__uuid__notes_post",
        "security": [
          {
            "APIKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "uuid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "UUID"
            },
            "description": "The UUID of the feedback entry"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "note"
                ],
                "properties": {
                  "note": {
                    "type": "string",
                    "minLength": 1,
                    "title": "Note",
                    "description": "The note text; the note author is recorded as 'API'"
                  }
                },
                "title": "Add Feedback Note Request"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "feedback_uuid",
                    "note"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "title": "Success"
                    },
                    "feedback_uuid": {
                      "type": "string",
                      "format": "uuid",
                      "title": "Feedback UUID",
                      "description": "The UUID of the feedback entry the note was added to"
                    },
                    "note": {
                      "type": "object",
                      "required": [
                        "author_name",
                        "note_text",
                        "created_at"
                      ],
                      "properties": {
                        "author_name": {
                          "type": "string",
                          "title": "Author Name",
                          "description": "Always 'API' for notes created with an API key"
                        },
                        "note_text": {
                          "type": "string",
                          "title": "Note Text"
                        },
                        "created_at": {
                          "type": "string",
                          "format": "date-time",
                          "title": "Created At"
                        }
                      },
                      "title": "Feedback Note"
                    }
                  },
                  "title": "Add Feedback Note Response"
                }
              }
            }
          },
          "404": {
            "description": "Feedback not found"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/feedback": {
      "get": {
        "tags": [
          "Feedback"
        ],
        "summary": "List Feedback",
        "description": "List utterance feedback left on call transcripts for your organization. Supports filtering and pagination.",
        "operationId": "list_feedback_feedback_get",
        "security": [
          {
            "APIKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 1,
              "title": "Page"
            },
            "description": "Page number for pagination"
          },
          {
            "name": "page_size",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 20,
              "maximum": 100,
              "title": "Page Size"
            },
            "description": "Number of feedback entries per page (max 100)"
          },
          {
            "name": "category",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "wrong_action",
                "skipped_verification",
                "incorrect_information",
                "transfer_handling",
                "conversation_quality",
                "data_integration",
                "transcription_error",
                "interruption_handling",
                "tag_error",
                "other"
              ],
              "title": "Category"
            },
            "description": "Filter by feedback category. See the List Feedback guide for what each category means."
          },
          {
            "name": "priority",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "critical",
                "high",
                "medium",
                "low",
                "unspecified"
              ],
              "title": "Priority"
            },
            "description": "Filter by reviewer-assigned priority. Use `unspecified` for feedback that has no priority."
          },
          {
            "name": "agent_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Agent ID"
            },
            "description": "Filter by agent UUID"
          },
          {
            "name": "call_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Call ID"
            },
            "description": "Filter by call UUID"
          },
          {
            "name": "resolved",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "title": "Resolved"
            },
            "description": "Filter by resolved state (true = marked as fixed, false = open)"
          },
          {
            "name": "created_at_gte",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time",
              "title": "Created At Greater Than or Equal"
            },
            "description": "Filter feedback created at or after this datetime (ISO 8601 format)"
          },
          {
            "name": "created_at_lte",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time",
              "title": "Created At Less Than or Equal"
            },
            "description": "Filter feedback created at or before this datetime (ISO 8601 format)"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "feedback": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/UtteranceFeedbackResponse"
                      }
                    },
                    "total_count": {
                      "type": "integer",
                      "title": "Total Count"
                    },
                    "page": {
                      "type": "integer",
                      "title": "Page"
                    },
                    "page_size": {
                      "type": "integer",
                      "title": "Page Size"
                    },
                    "total_pages": {
                      "type": "integer",
                      "title": "Total Pages"
                    }
                  },
                  "required": [
                    "feedback",
                    "total_count",
                    "page",
                    "page_size",
                    "total_pages"
                  ],
                  "title": "Utterance Feedback List Response"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/calls": {
      "post": {
        "tags": ["Calls"],
        "summary": "Create Call",
        "description": "Create a new call via the public API.\nRequires a valid API key.\n\nIf `idempotency_key` is provided, duplicate requests with the same JSON body return the original response.\nReusing the same `idempotency_key` with a different JSON body returns `409 Conflict`.",
        "operationId": "create_call_calls_post",
        "security": [{ "APIKeyHeader": [] }],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/CallRequest" },
              "examples": {
                "inlinePrompt": {
                  "summary": "Call with an inline prompt",
                  "value": {
                    "to_number": "+15551234567",
                    "prompt": "You are a friendly assistant calling to confirm an appointment.",
                    "params": { "customer_name": "Dana" },
                    "idempotency_key": "appointment-1042-reminder"
                  }
                },
                "existingAgent": {
                  "summary": "Call with an existing agent",
                  "value": {
                    "to_number": "+15551234567",
                    "agent_id": "123e4567-e89b-12d3-a456-426614174000",
                    "params": { "customer_name": "Dana" },
                    "external_identifiers": { "appointment_id": "APT-1042" }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/CallResponse" },
                "example": {
                  "success": true,
                  "status": "enqueued",
                  "uuid": "346fe020-e8c2-4abe-9d40-a4992b016bd6"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/PublicApiError" }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/PublicApiError" }
              }
            }
          },
          "409": {
            "description": "Idempotency Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CallCreateConflictResponse"
                },
                "examples": {
                  "requestInProgress": {
                    "summary": "Request with this idempotency key is already in progress",
                    "value": {
                      "success": false,
                      "errors": ["idempotency_key request is already in progress"]
                    }
                  },
                  "requestBodyMismatch": {
                    "summary": "Idempotency key reused with a different request body",
                    "value": {
                      "success": false,
                      "errors": [
                        "idempotency_key has already been used with a different request body"
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": ["Calls"],
        "summary": "List Calls",
        "description": "List all calls associated with the API key's account.\nIncludes pagination support and filtering by status, transferred state, and creation date.\nDate filters accept ISO 8601 format (e.g., 2024-01-15T09:30:00Z).",
        "operationId": "list_calls_calls_get",
        "security": [{ "APIKeyHeader": [] }],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [{ "type": "integer" }, { "type": "null" }],
              "default": 1,
              "title": "Page"
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [{ "type": "integer" }, { "type": "null" }],
              "default": 20,
              "title": "Page Size"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "title": "Status"
            },
            "description": "Filter by call status. Multiple values can be provided separated by commas."
          },
          {
            "name": "agent_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "title": "Agent ID"
            },
            "description": "Filter by agent group UUID. Multiple values can be provided separated by commas. Returns calls from all versions of the specified agent(s)."
          },
          {
            "name": "agent_version_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Agent Version ID"
            },
            "description": "Filter by specific agent version UUID. Returns calls from only the specified agent version."
          },
          {
            "name": "transferred",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "title": "Transferred"
            },
            "description": "Filter by whether the call was transferred"
          },
          {
            "name": "created_at_gte",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time",
              "title": "Created At Greater Than or Equal"
            },
            "description": "Filter calls created at or after this datetime (ISO 8601 format)"
          },
          {
            "name": "created_at_lte",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time",
              "title": "Created At Less Than or Equal"
            },
            "description": "Filter calls created at or before this datetime (ISO 8601 format)"
          },
          {
            "name": "sort_by",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "created_at",
                "updated_at",
                "started_at",
                "ended_at",
                "duration",
                "status"
              ],
              "default": "created_at",
              "title": "Sort By"
            },
            "description": "Field to sort results by"
          },
          {
            "name": "sort_direction",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": ["asc", "desc"],
              "default": "desc",
              "title": "Sort Direction"
            },
            "description": "Sort direction"
          },
          {
            "name": "updated_at_gte",
            "in": "query",
            "required": false,
            "description": "Return calls last updated at or after this ISO 8601 timestamp (inclusive).",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "updated_at_lte",
            "in": "query",
            "required": false,
            "description": "Return calls last updated at or before this ISO 8601 timestamp (inclusive).",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/CallListResponse" }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/PublicApiError" }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/PublicApiError" }
              }
            }
          }
        }
      }
    },
    "/calls/{uuid}": {
      "get": {
        "tags": ["Calls"],
        "summary": "Get Call Details",
        "description": "Get details for a specific call.\nOnly returns calls associated with the API key's account.",
        "operationId": "get_call_details_calls__uuid__get",
        "security": [{ "APIKeyHeader": [] }],
        "parameters": [
          {
            "name": "uuid",
            "in": "path",
            "required": true,
            "schema": { "type": "string", "format": "uuid", "title": "Uuid" }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/CallDetailsResponse" }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/PublicApiError" }
              }
            }
          },
          "404": {
            "description": "Call not found",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/PublicApiError" }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/PublicApiError" }
              }
            }
          }
        }
      },
      "delete": {
        "tags": ["Calls"],
        "summary": "Delete Call",
        "description": "Delete a call. This operation is unrecoverable.",
        "operationId": "delete_call_calls__uuid__delete",
        "security": [{ "APIKeyHeader": [] }],
        "parameters": [
          {
            "name": "uuid",
            "in": "path",
            "required": true,
            "schema": { "type": "string", "format": "uuid", "title": "Uuid" }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "default": true
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "default": "Call not found"
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/PublicApiError" }
              }
            }
          }
        }
      }
    },
    "/calls/{uuid}/cancel": {
      "post": {
        "tags": ["Calls"],
        "summary": "Cancel Call",
        "description": "Cancel a call that has not started yet.\nOnly calls with status `enqueued` can be cancelled. Cancelling a call that is already cancelled succeeds.",
        "operationId": "cancel_call_calls__uuid__cancel_post",
        "security": [{ "APIKeyHeader": [] }],
        "parameters": [
          {
            "name": "uuid",
            "in": "path",
            "required": true,
            "schema": { "type": "string", "format": "uuid", "title": "Uuid" }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/CallResponse" },
                "example": {
                  "success": true,
                  "status": "cancelled",
                  "uuid": "346fe020-e8c2-4abe-9d40-a4992b016bd6"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/PublicApiError" }
              }
            }
          },
          "404": {
            "description": "Call not found",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/PublicApiError" }
              }
            }
          },
          "409": {
            "description": "The call has already started or finished",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/PublicApiError" }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/PublicApiError" }
              }
            }
          }
        }
      }
    },
    "/calls/find_by_attribute": {
      "get": {
        "tags": ["Calls"],
        "summary": "Find Call by Attribute",
        "description": "Find the most recent call matching parameter or external identifier key/value pairs. Use the optional fields parameter to return a compact call object instead of the full call details.",
        "operationId": "find_call_by_attribute_calls_find_by_attribute_get",
        "security": [{ "APIKeyHeader": [] }],
        "parameters": [
          {
            "name": "param_key",
            "in": "query",
            "required": false,
            "schema": { "type": "string", "title": "Param Key" },
            "description": "The key to search for in the call's params field"
          },
          {
            "name": "param_value",
            "in": "query",
            "required": false,
            "schema": { "type": "string", "title": "Param Value" },
            "description": "The value to match for the specified param_key"
          },
          {
            "name": "external_identifier_key",
            "in": "query",
            "required": false,
            "schema": { "type": "string", "title": "External Identifier Key" },
            "description": "The key to search for in the call's external_identifiers field"
          },
          {
            "name": "external_identifier_value",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "title": "External Identifier Value"
            },
            "description": "The value to match for the specified external_identifier_key"
          },
          {
            "name": "fields",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 1000,
              "example": "id,summary,status,params.disposition"
            },
            "description": "Comma-separated fields to return, with a maximum of 50 fields. Supported call fields are id, summary, status, duration, transferred, agent_id, agent_commit_id, and screen_pop_token. Select individual call parameters with params.<key>. The full call is returned when omitted."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CallFindByAttributeResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "default": false
                    },
                    "errors": {
                      "type": "array",
                      "items": { "type": "string" }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "default": false
                    },
                    "errors": {
                      "type": "array",
                      "items": { "type": "string" }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/call_tags": {
      "get": {
        "tags": ["Call Tags"],
        "summary": "List Call Tags",
        "description": "List all call tags associated with the organization. Supports pagination with up to 100 tags per page.",
        "operationId": "list_call_tags_call_tags_get",
        "security": [{ "APIKeyHeader": [] }],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 1,
              "title": "Page"
            },
            "description": "Page number for pagination"
          },
          {
            "name": "page_size",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 100,
              "maximum": 100,
              "title": "Page Size"
            },
            "description": "Number of tags per page (max 100)"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "call_tags": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/CallTagResponse"
                      }
                    },
                    "total_count": {
                      "type": "integer",
                      "title": "Total Count"
                    },
                    "page": {
                      "type": "integer",
                      "title": "Page"
                    },
                    "page_size": {
                      "type": "integer",
                      "title": "Page Size"
                    },
                    "total_pages": {
                      "type": "integer",
                      "title": "Total Pages"
                    }
                  },
                  "required": ["call_tags", "total_count", "page", "page_size", "total_pages"]
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/HTTPValidationError" }
              }
            }
          }
        }
      },
      "post": {
        "tags": ["Call Tags"],
        "summary": "Create Call Tag",
        "description": "Create a new call tag for the organization.",
        "operationId": "create_call_tag_call_tags_post",
        "security": [{ "APIKeyHeader": [] }],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CallTagRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Call Tag Created Successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "default": true
                    },
                    "call_tag": {
                      "$ref": "#/components/schemas/CallTagResponse"
                    }
                  },
                  "required": ["success", "call_tag"]
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "default": false
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/calls/{uuid}/call_notes": {
      "get": {
        "tags": ["Call Notes"],
        "summary": "List Call Notes",
        "description": "List all notes for a specific call. Supports pagination.",
        "operationId": "list_call_notes_calls__uuid__call_notes_get",
        "security": [{ "APIKeyHeader": [] }],
        "parameters": [
          {
            "name": "uuid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Uuid"
            },
            "description": "The UUID of the call"
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 1,
              "title": "Page"
            },
            "description": "Page number for pagination"
          },
          {
            "name": "page_size",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 20,
              "title": "Page Size"
            },
            "description": "Number of notes per page"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "call_notes": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/CallNoteResponse"
                      }
                    },
                    "total_count": {
                      "type": "integer",
                      "title": "Total Count"
                    },
                    "page": {
                      "type": "integer",
                      "title": "Page"
                    },
                    "page_size": {
                      "type": "integer",
                      "title": "Page Size"
                    },
                    "total_pages": {
                      "type": "integer",
                      "title": "Total Pages"
                    }
                  },
                  "required": ["call_notes", "total_count", "page", "page_size", "total_pages"]
                }
              }
            }
          },
          "404": {
            "description": "Call Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "default": "Call not found"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": ["Call Notes"],
        "summary": "Create Call Note",
        "description": "Create a new note for a specific call.",
        "operationId": "create_call_note_calls__uuid__call_notes_post",
        "security": [{ "APIKeyHeader": [] }],
        "parameters": [
          {
            "name": "uuid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Uuid"
            },
            "description": "The UUID of the call"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CallNoteRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Call Note Created Successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "default": true
                    },
                    "call_note": {
                      "$ref": "#/components/schemas/CallNoteResponse"
                    }
                  },
                  "required": ["success", "call_note"]
                }
              }
            }
          },
          "404": {
            "description": "Call Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "default": "Call not found"
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "default": false
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/calls/{uuid}/tags": {
      "patch": {
        "tags": ["Calls"],
        "summary": "Update Call Tags",
        "description": "Update the tags associated with a specific call. Replaces all existing tags with the provided list.",
        "operationId": "update_call_tags_calls__uuid__tags_patch",
        "security": [{ "APIKeyHeader": [] }],
        "parameters": [
          {
            "name": "uuid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["tags"],
                "properties": {
                  "tags": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "title": "Tags",
                    "description": "Array of call tag UUIDs to assign to the call"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Tags Updated Successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "default": true
                    },
                    "call": {
                      "$ref": "#/components/schemas/CallDetailsResponse"
                    }
                  },
                  "required": ["success", "call"]
                }
              }
            }
          },
          "404": {
            "description": "Call or Tags Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "default": false
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "default": false
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/agents": {
      "get": {
        "tags": ["Agents"],
        "summary": "List Agents",
        "description": "List all agents associated with the API key's account.",
        "operationId": "list_agents_agents_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "items": { "$ref": "#/components/schemas/AgentResponse" },
                  "type": "array",
                  "title": "Response List Agents Agents Get"
                }
              }
            }
          }
        },
        "security": [{ "APIKeyHeader": [] }]
      }
    },
    "/agents/{agent_id}": {
      "get": {
        "tags": ["Agents"],
        "summary": "Get Agent",
        "description": "Get details for a specific agent.\nOnly returns agents associated with the API key's account.",
        "operationId": "get_agent_agents__agent_id__get",
        "security": [{ "APIKeyHeader": [] }],
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Agent Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/AgentResponse" }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/HTTPValidationError" }
              }
            }
          }
        }
      }
    },
    "/numbers": {
      "get": {
        "tags": ["Numbers"],
        "summary": "List Numbers",
        "description": "List all phone numbers associated with the organization.",
        "operationId": "list_numbers_numbers_get",
        "security": [{ "APIKeyHeader": [] }],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PhoneNumberResponse"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/numbers/{uuid}": {
      "get": {
        "tags": ["Numbers"],
        "summary": "Get Number Details",
        "description": "Get details for a specific phone number.",
        "operationId": "get_number_details_numbers__uuid__get",
        "security": [{ "APIKeyHeader": [] }],
        "parameters": [
          {
            "name": "uuid",
            "in": "path",
            "required": true,
            "schema": { "type": "string", "format": "uuid", "title": "Uuid" }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/PhoneNumberResponse" }
              }
            }
          },
          "404": {
            "description": "Number Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": ["Numbers"],
        "summary": "Update Number",
        "description": "Update the friendly name of a phone number.",
        "operationId": "update_number_numbers__uuid__patch",
        "security": [{ "APIKeyHeader": [] }],
        "parameters": [
          {
            "name": "uuid",
            "in": "path",
            "required": true,
            "schema": { "type": "string", "format": "uuid", "title": "Uuid" }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "friendly_name": {
                    "type": "string",
                    "title": "Friendly Name",
                    "description": "The new friendly name for the phone number"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/PhoneNumberResponse" }
              }
            }
          },
          "404": {
            "description": "Number Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": ["Numbers"],
        "summary": "Delete Number",
        "description": "Release and delete a phone number. This releases the number from Twilio and removes it from your account. This operation cannot be undone.",
        "operationId": "delete_number_numbers__uuid__delete",
        "security": [{ "APIKeyHeader": [] }],
        "parameters": [
          {
            "name": "uuid",
            "in": "path",
            "required": true,
            "schema": { "type": "string", "format": "uuid", "title": "Uuid" }
          }
        ],
        "responses": {
          "200": {
            "description": "Number Deleted Successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "default": true
                    },
                    "message": {
                      "type": "string",
                      "description": "Success message"
                    }
                  },
                  "required": ["success", "message"]
                }
              }
            }
          },
          "404": {
            "description": "Number Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "default": "Phone number not found"
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Deletion Failed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "default": false
                    },
                    "error": {
                      "type": "string",
                      "description": "Error message describing why the deletion failed"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/numbers/search_available": {
      "get": {
        "tags": ["Numbers"],
        "summary": "Search Available Numbers",
        "description": "Search for available phone numbers to purchase.",
        "operationId": "search_available_numbers_numbers_search_get",
        "security": [{ "APIKeyHeader": [] }],
        "parameters": [
          {
            "name": "area_code",
            "in": "query",
            "required": false,
            "schema": { "type": "string", "title": "Area Code" }
          },
          {
            "name": "country",
            "in": "query",
            "required": false,
            "schema": { "type": "string", "title": "Country" }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AvailableNumberResponse"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/numbers/buy_number": {
      "post": {
        "tags": ["Numbers"],
        "summary": "Buy Number",
        "description": "Purchase a phone number.",
        "operationId": "buy_number_numbers_buy_post",
        "security": [{ "APIKeyHeader": [] }],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["phone_number"],
                "properties": {
                  "phone_number": {
                    "type": "string",
                    "title": "Phone Number",
                    "description": "The phone number to purchase"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/PhoneNumberResponse" }
              }
            }
          },
          "422": {
            "description": "Purchase Failed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/numbers/{uuid}/assign_agent": {
      "post": {
        "tags": ["Numbers"],
        "summary": "Assign Agent to Number",
        "description": "Assign an agent to handle calls for a specific phone number.",
        "operationId": "assign_agent_numbers__uuid__assign_agent_post",
        "security": [{ "APIKeyHeader": [] }],
        "parameters": [
          {
            "name": "uuid",
            "in": "path",
            "required": true,
            "schema": { "type": "string", "format": "uuid", "title": "Uuid" }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["agent_uuid"],
                "properties": {
                  "agent_uuid": {
                    "type": "string",
                    "format": "uuid",
                    "title": "Agent UUID",
                    "description": "The UUID of the agent to assign"
                  },
                  "version_id": {
                    "type": "string",
                    "format": "uuid",
                    "title": "Version Id",
                    "description": "When assigning an agent, specifies which agent version to use. If not provided, uses the most recently updated version.",
                    "examples": ["456e7890-e89b-12d3-a456-426614174000"]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Number or Agent Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/webhooks": {
      "post": {
        "tags": ["Webhooks"],
        "summary": "Create Webhook",
        "description": "Create a new webhook endpoint for receiving event notifications.\nRequires a valid API key.",
        "operationId": "create_webhook_webhooks_post",
        "security": [{ "APIKeyHeader": [] }],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/WebhookRequest" }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Webhook Created Successfully",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/WebhookResponse" }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/HTTPValidationError" }
              }
            }
          }
        }
      },
      "get": {
        "tags": ["Webhooks"],
        "summary": "List Webhooks",
        "description": "List all webhook endpoints associated with the organization.\nRequires a valid API key.",
        "operationId": "list_webhooks_webhooks_get",
        "security": [{ "APIKeyHeader": [] }],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "endpoints": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/WebhookResponse"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/webhooks/{endpoint_id}": {
      "delete": {
        "tags": ["Webhooks"],
        "summary": "Delete Webhook",
        "description": "Delete a webhook endpoint by ID.\nRequires a valid API key.",
        "operationId": "delete_webhook_webhooks__endpoint_id__delete",
        "security": [{ "APIKeyHeader": [] }],
        "parameters": [
          {
            "name": "endpoint_id",
            "in": "path",
            "required": true,
            "schema": { "type": "string", "title": "Endpoint ID" }
          }
        ],
        "responses": {
          "204": {
            "description": "Webhook Deleted Successfully"
          },
          "422": {
            "description": "Deletion Failed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/interactions": {
      "get": {
        "tags": ["Interactions"],
        "summary": "List Interactions",
        "description": "List all interactions (calls, text conversations, and external-channel interactions) associated with the API key's account.\nIncludes pagination support and filtering by status, modality, transferred state, external-channel inclusion, and creation date.\nDate filters accept ISO 8601 format (e.g., 2024-01-15T09:30:00Z).",
        "operationId": "list_interactions_interactions_get",
        "security": [{ "APIKeyHeader": [] }],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [{ "type": "integer" }, { "type": "null" }],
              "default": 1,
              "title": "Page"
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [{ "type": "integer" }, { "type": "null" }],
              "default": 20,
              "title": "Page Size"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "title": "Status"
            },
            "description": "Filter by interaction status. Multiple values can be provided separated by commas."
          },
          {
            "name": "modality",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": ["voice", "text"],
              "title": "Modality"
            },
            "description": "Filter by interaction modality (voice or text)"
          },
          {
            "name": "agent_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "title": "Agent ID"
            },
            "description": "Filter by agent group UUID. Multiple values can be provided separated by commas. Returns interactions from all versions of the specified agent(s)."
          },
          {
            "name": "agent_version_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Agent Version ID"
            },
            "description": "Filter by specific agent version UUID. Returns interactions from only the specified agent version."
          },
          {
            "name": "transferred",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "title": "Transferred"
            },
            "description": "Filter by whether the interaction was transferred"
          },
          {
            "name": "include_external_channels",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false,
              "title": "Include External Channels"
            },
            "description": "External-channel calls (uploaded or ingested from external sources, grouped as one interaction per session) are excluded by default. Pass `true` to include them alongside native calls and conversations."
          },
          {
            "name": "created_at_gte",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time",
              "title": "Created At Greater Than or Equal"
            },
            "description": "Filter interactions created at or after this datetime (ISO 8601 format). For external-channel interactions this compares against the call (leg start) time rather than the returned `created_at` ingestion timestamp."
          },
          {
            "name": "created_at_lte",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time",
              "title": "Created At Less Than or Equal"
            },
            "description": "Filter interactions created at or before this datetime (ISO 8601 format). For external-channel interactions this compares against the call (leg start) time rather than the returned `created_at` ingestion timestamp."
          },
          {
            "name": "updated_at_gte",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time",
              "title": "Updated At Greater Than or Equal"
            },
            "description": "Filter interactions last updated at or after this datetime (ISO 8601 format). Reflects the last change to the interaction record itself. For external-channel interactions this compares against the underlying session's last update time."
          },
          {
            "name": "updated_at_lte",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time",
              "title": "Updated At Less Than or Equal"
            },
            "description": "Filter interactions last updated at or before this datetime (ISO 8601 format)."
          },
          {
            "name": "sort_by",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "created_at",
                "updated_at",
                "started_at",
                "ended_at",
                "duration",
                "status"
              ],
              "default": "created_at",
              "title": "Sort By"
            },
            "description": "Field to sort results by"
          },
          {
            "name": "sort_direction",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": ["asc", "desc"],
              "default": "desc",
              "title": "Sort Direction"
            },
            "description": "Sort direction"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/InteractionListResponse" }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/HTTPValidationError" }
              }
            }
          }
        }
      }
    },
    "/interactions/{uuid}": {
      "get": {
        "tags": ["Interactions"],
        "summary": "Get Interaction Details",
        "description": "Get details for a specific interaction.\nOnly returns interactions associated with the API key's account.",
        "operationId": "get_interaction_details_interactions__uuid__get",
        "security": [{ "APIKeyHeader": [] }],
        "parameters": [
          {
            "name": "uuid",
            "in": "path",
            "required": true,
            "schema": { "type": "string", "format": "uuid", "title": "Uuid" }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/InteractionDetailsResponse" }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "default": "Interaction not found"
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/HTTPValidationError" }
              }
            }
          }
        }
      }
    },
    "/voices": {
      "get": {
        "tags": ["Voices"],
        "summary": "List Voices",
        "description": "List all voices associated with the organization.",
        "operationId": "list_voices_voices_get",
        "security": [{ "APIKeyHeader": [] }],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/VoiceResponse"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/voices/{uuid}": {
      "get": {
        "tags": ["Voices"],
        "summary": "Get Voice Details",
        "description": "Get details for a specific voice.\nOnly returns voices associated with the organization.",
        "operationId": "get_voice_details_voices__uuid__get",
        "security": [{ "APIKeyHeader": [] }],
        "parameters": [
          {
            "name": "uuid",
            "in": "path",
            "required": true,
            "schema": { "type": "string", "format": "uuid", "title": "Uuid" }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/VoiceResponse" }
              }
            }
          },
          "404": {
            "description": "Voice Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "default": "Voice not found"
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/HTTPValidationError" }
              }
            }
          }
        }
      }
    },
    "/contacts": {
      "get": {
        "tags": ["Contacts"],
        "summary": "List Contacts",
        "operationId": "list_contacts",
        "security": [{ "APIKeyHeader": [] }],
        "responses": {
          "200": {
            "description": "List Contacts",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ListContactsResponse" }
              }
            }
          },
          "401": {
            "description": "Authentication failed.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/PublicApiError" }
              }
            }
          },
          "422": {
            "description": "The request or an attribute value is invalid.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/PublicApiError" }
              }
            }
          }
        },
        "description": "List active contacts in the authenticated organization, ordered by UUID. Supplied filters are combined. externalId requires sourceKey. Continue with after=nextCursor while hasMore is true.",
        "parameters": [
          {
            "name": "sourceKey",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 63,
              "pattern": "^[a-z][a-z0-9]*(?:_[a-z0-9]+)*$",
              "description": "Stable lowercase snake_case identifier for the source."
            }
          },
          {
            "name": "externalId",
            "in": "query",
            "required": false,
            "schema": { "type": "string", "minLength": 1, "maxLength": 1000 }
          },
          {
            "name": "phoneNumber",
            "in": "query",
            "required": false,
            "schema": { "type": "string", "pattern": "^\\+[1-9]\\d{1,14}$" }
          },
          {
            "name": "email",
            "in": "query",
            "required": false,
            "schema": { "type": "string", "format": "email" }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "after",
            "in": "query",
            "required": false,
            "schema": { "type": "string", "format": "uuid" }
          }
        ]
      }
    },
    "/contacts/{contactId}": {
      "get": {
        "tags": ["Contacts"],
        "summary": "Get Contact",
        "operationId": "get_contact_by_uuid",
        "security": [{ "APIKeyHeader": [] }],
        "responses": {
          "200": {
            "description": "Get Contact",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/SyncedContact" }
              }
            }
          },
          "401": {
            "description": "Authentication failed.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/PublicApiError" }
              }
            }
          },
          "422": {
            "description": "The request or an attribute value is invalid.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/PublicApiError" }
              }
            }
          },
          "404": {
            "description": "Contact missing, deleted, or outside the authenticated organization.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/PublicApiError" }
              }
            }
          }
        },
        "description": "Read an active contact by UUID within the authenticated organization, including attributes, external identities, and consent records.",
        "parameters": [
          {
            "name": "contactId",
            "in": "path",
            "required": true,
            "schema": { "type": "string", "format": "uuid" }
          }
        ]
      },
      "delete": {
        "tags": ["Contacts"],
        "summary": "Delete Contact",
        "description": "Delete an active contact by UUID within the authenticated organization. The contact no longer appears in reads, and a sync source can send the contact's external IDs and event IDs again to create a new contact. Opt-outs recorded for its phone number are kept.",
        "operationId": "delete_contact_by_uuid",
        "security": [{ "APIKeyHeader": [] }],
        "parameters": [
          {
            "name": "contactId",
            "in": "path",
            "required": true,
            "schema": { "type": "string", "format": "uuid" }
          }
        ],
        "responses": {
          "200": {
            "description": "The contact was deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteContactResponse"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/PublicApiError" }
              }
            }
          },
          "404": {
            "description": "Contact missing, already deleted, or outside the authenticated organization.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/PublicApiError" }
              }
            }
          },
          "422": {
            "description": "The contact ID is not a valid UUID.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/PublicApiError" }
              }
            }
          }
        }
      }
    },
    "/contacts/upsert": {
      "post": {
        "tags": ["Contacts"],
        "summary": "Upsert Synced Contact",
        "description": "Create or update a contact, define its source and fields, and record number-specific consent in one transaction. Accepts source strings and optional event ordering.",
        "operationId": "upsert_synced_contact_contacts_upsert_post",
        "security": [{ "APIKeyHeader": [] }],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpsertSyncedContactRequest"
              },
              "example": {
                "source": {
                  "key": "salesforce",
                  "name": "Salesforce",
                  "provider": "salesforce"
                },
                "fields": {
                  "name": { "label": "Name", "type": "text" },
                  "email": { "label": "Email", "type": "email" },
                  "phone_number": { "label": "Phone number", "type": "phone" },
                  "lifecycle_stage": {
                    "label": "Lifecycle stage",
                    "description": "Current Salesforce lifecycle stage",
                    "type": "enum",
                    "enumOptions": ["lead", "customer"]
                  }
                },
                "externalId": "lead-42",
                "name": "Ada Lovelace",
                "email": "ada@example.com",
                "phoneNumber": "+14155550100",
                "attributes": { "lifecycle_stage": "lead" }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Contact updated or linked, or an event skipped with the current contact returned.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpsertSyncedContactResponse"
                }
              }
            }
          },
          "201": {
            "description": "A new contact was created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpsertSyncedContactResponse"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/PublicApiError" }
              }
            }
          },
          "409": {
            "description": "Source, field, identity, event ID, or source timestamp conflict.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/PublicApiError" }
              }
            }
          },
          "422": {
            "description": "The request or an attribute value is invalid.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/PublicApiError" }
              }
            }
          }
        }
      }
    },
    "/contacts/fields/{fieldKey}": {
      "delete": {
        "tags": ["Contacts"],
        "summary": "Delete Synced Contact Field",
        "description": "Delete a contact field definition a sync source created, together with the values stored for it on every contact, so a source can define the same key again with a new type or enum options.",
        "operationId": "delete_synced_contact_field",
        "security": [{ "APIKeyHeader": [] }],
        "parameters": [
          {
            "name": "fieldKey",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 63,
              "pattern": "^[a-z][a-z0-9]*(?:_[a-z0-9]+)*$"
            },
            "description": "Key of the field to delete."
          }
        ],
        "responses": {
          "200": {
            "description": "The field was deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteSyncedContactFieldResponse"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/PublicApiError" }
              }
            }
          },
          "404": {
            "description": "The organization has no field with this key.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/PublicApiError" }
              }
            }
          },
          "409": {
            "description": "The field was created in Simple, or a contact segment or the call params mapping uses it. Nothing is deleted.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/PublicApiError" }
              }
            }
          },
          "422": {
            "description": "The key is invalid or names the name, email, or phone_number field.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/PublicApiError" }
              }
            }
          }
        }
      }
    },
    "/contacts/{phoneNumber}/data": {
      "put": {
        "tags": ["Contacts"],
        "summary": "Replace Contact Data",
        "description": "Replace the complete JSON object stored for a phone number. The data is scoped to the authenticated organization, and an unknown phone number gets a contact automatically.",
        "operationId": "replace_contact_data_contacts__phoneNumber__data_put",
        "security": [{ "APIKeyHeader": [] }],
        "parameters": [
          {
            "name": "phoneNumber",
            "in": "path",
            "required": true,
            "schema": { "type": "string" },
            "description": "The caller's phone number or other caller identifier. US numbers may be formatted or sent as digits; non-US numbers must include the + country code. Non-phone identifiers (for example chat or SIP identifiers) are accepted verbatim, up to 128 characters."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/ContactDataRequest" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Contact data replaced.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ContactDataResponse" }
              }
            }
          },
          "401": {
            "description": "Authentication failed.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/PublicApiError" }
              }
            }
          },
          "422": {
            "description": "The phone number or request body is invalid.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/PublicApiError" }
              }
            }
          }
        }
      },
      "patch": {
        "tags": ["Contacts"],
        "summary": "Merge Contact Data",
        "description": "Shallow-merge top-level fields into the JSON object stored for a phone number. Set a field to null to delete it.",
        "operationId": "merge_contact_data_contacts__phoneNumber__data_patch",
        "security": [{ "APIKeyHeader": [] }],
        "parameters": [
          {
            "name": "phoneNumber",
            "in": "path",
            "required": true,
            "schema": { "type": "string" },
            "description": "The caller's phone number or other caller identifier. US numbers may be formatted or sent as digits; non-US numbers must include the + country code. Non-phone identifiers (for example chat or SIP identifiers) are accepted verbatim, up to 128 characters."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/ContactDataRequest" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Contact data merged.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ContactDataResponse" }
              }
            }
          },
          "401": {
            "description": "Authentication failed.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/PublicApiError" }
              }
            }
          },
          "422": {
            "description": "The phone number or request body is invalid.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/PublicApiError" }
              }
            }
          }
        }
      },
      "get": {
        "tags": ["Contacts"],
        "summary": "Read Contact Data",
        "description": "Read the current JSON object stored for a phone number in the authenticated organization. Stored keys are returned at the top level; if a stored key collides with a metadata field name, the metadata value wins.",
        "operationId": "read_contact_data_contacts__phoneNumber__data_get",
        "security": [{ "APIKeyHeader": [] }],
        "parameters": [
          {
            "name": "phoneNumber",
            "in": "path",
            "required": true,
            "schema": { "type": "string" },
            "description": "The caller's phone number or other caller identifier. US numbers may be formatted or sent as digits; non-US numbers must include the + country code. Non-phone identifiers (for example chat or SIP identifiers) are accepted verbatim, up to 128 characters."
          }
        ],
        "responses": {
          "200": {
            "description": "Current contact data.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ContactDataGetResponse" }
              }
            }
          },
          "401": {
            "description": "Authentication failed.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/PublicApiError" }
              }
            }
          },
          "404": {
            "description": "No current data exists for this phone number.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/PublicApiError" }
              }
            }
          },
          "422": {
            "description": "The phone number is invalid.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/PublicApiError" }
              }
            }
          }
        }
      },
      "delete": {
        "tags": ["Contacts"],
        "summary": "Delete Contact Data",
        "description": "Delete the current JSON object stored for a phone number. Deletion is idempotent and preserves revision history.",
        "operationId": "delete_contact_data_contacts__phoneNumber__data_delete",
        "security": [{ "APIKeyHeader": [] }],
        "parameters": [
          {
            "name": "phoneNumber",
            "in": "path",
            "required": true,
            "schema": { "type": "string" },
            "description": "The caller's phone number or other caller identifier. US numbers may be formatted or sent as digits; non-US numbers must include the + country code. Non-phone identifiers (for example chat or SIP identifiers) are accepted verbatim, up to 128 characters."
          }
        ],
        "responses": {
          "200": {
            "description": "Contact data deletion result.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/DeleteContactDataResponse" }
              }
            }
          },
          "401": {
            "description": "Authentication failed.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/PublicApiError" }
              }
            }
          },
          "422": {
            "description": "The phone number is invalid.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/PublicApiError" }
              }
            }
          }
        }
      }
    },
    "/data/tables": {
      "get": {
        "tags": ["Custom Data"],
        "summary": "List Custom Data Tables",
        "description": "List the custom data tables for the authenticated organization, including each table's columns and record count.",
        "operationId": "list_custom_data_tables_data_tables_get",
        "security": [{ "APIKeyHeader": [] }],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": { "$ref": "#/components/schemas/CustomDataTable" }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          }
        }
      },
      "post": {
        "tags": ["Custom Data"],
        "summary": "Create Custom Data Table",
        "description": "Create a custom data table and its column schema for the authenticated organization.",
        "operationId": "create_custom_data_table_data_tables_post",
        "security": [{ "APIKeyHeader": [] }],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/CustomDataTableCreate" }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Custom Data Table Created",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/CustomDataTable" }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          }
        }
      }
    },
    "/data/tables/reference-tables": {
      "get": {
        "tags": ["Custom Data"],
        "summary": "List Available Reference Tables",
        "description": "List system and custom tables that can be used as targets for REFERENCE columns.",
        "operationId": "list_custom_data_reference_tables_data_tables_reference_tables_get",
        "security": [{ "APIKeyHeader": [] }],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": { "$ref": "#/components/schemas/AvailableReferenceTable" }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          }
        }
      }
    },
    "/data/tables/{id}": {
      "patch": {
        "tags": ["Custom Data"],
        "summary": "Update Custom Data Table",
        "description": "Update a custom data table's label, search indexing setting, and column schema.",
        "operationId": "update_custom_data_table_data_tables__id__patch",
        "security": [{ "APIKeyHeader": [] }],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": { "type": "integer", "title": "ID" },
            "description": "Custom data table ID."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/CustomDataTableUpdate" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Custom Data Table Updated",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/CustomDataTable" }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          },
          "404": {
            "description": "Custom Data Table Not Found",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          }
        }
      },
      "delete": {
        "tags": ["Custom Data"],
        "summary": "Delete Custom Data Table",
        "description": "Delete an empty custom data table. Tables that still contain records or are referenced by another table cannot be deleted.",
        "operationId": "delete_custom_data_table_data_tables__id__delete",
        "security": [{ "APIKeyHeader": [] }],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": { "type": "integer", "title": "ID" },
            "description": "Custom data table ID."
          }
        ],
        "responses": {
          "200": {
            "description": "Custom Data Table Deleted",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/DeleteCustomDataTableResponse" }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          },
          "404": {
            "description": "Custom Data Table Not Found",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          }
        }
      }
    },
    "/data/query": {
      "post": {
        "tags": ["Custom Data"],
        "summary": "Query Custom Data",
        "description": "Deterministic facet-filtered query against a single custom data table that has search indexing enabled. Provide exact-match `filters` and/or a free-text `text`; omit both to get the most recent records.",
        "operationId": "query_custom_data_data_query_post",
        "security": [{ "APIKeyHeader": [] }],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/CustomDataQueryRequest" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/CustomDataQueryResponse" }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          }
        }
      }
    },
    "/data/facets/{table_name}": {
      "get": {
        "tags": ["Custom Data"],
        "summary": "Get Custom Data Facets",
        "description": "Return distinct values and counts for facetable columns in an indexed custom data table.",
        "operationId": "get_custom_data_facets_data_facets__table_name__get",
        "security": [{ "APIKeyHeader": [] }],
        "parameters": [
          {
            "name": "table_name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9_]+$",
              "title": "Table Name"
            },
            "description": "Custom data table name."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/CustomDataFacetsResponse" }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          },
          "404": {
            "description": "Custom Data Table Not Found",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          }
        }
      }
    },
    "/data/{table_name}": {
      "get": {
        "tags": ["Custom Data"],
        "summary": "List Custom Data Records",
        "description": "List records in a custom data table. Query parameters matching declared table columns or managed columns are treated as exact-match filters.",
        "operationId": "list_custom_data_records_data__table_name__get",
        "security": [{ "APIKeyHeader": [] }],
        "parameters": [
          {
            "name": "table_name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]+$",
              "title": "Table Name"
            },
            "description": "Custom data table name."
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": { "type": "integer", "default": 1, "title": "Page" },
            "description": "Page number. Invalid or non-positive values default to 1."
          },
          {
            "name": "per_page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 50,
              "maximum": 200,
              "title": "Per Page"
            },
            "description": "Number of records per page. Values above 200 are capped at 200."
          },
          {
            "name": "order_by",
            "in": "query",
            "required": false,
            "schema": { "type": "string", "default": "created_at", "title": "Order By" },
            "description": "Column used for sorting. Use a declared table column or one of id, organization_id, created_at, updated_at."
          },
          {
            "name": "order_direction",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": ["ASC", "DESC", "asc", "desc"],
              "default": "DESC",
              "title": "Order Direction"
            },
            "description": "Sort direction. Any value other than ASC defaults to DESC."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/CustomDataRecordListResponse" }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          },
          "404": {
            "description": "Custom Data Table Not Found",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          }
        }
      },
      "put": {
        "tags": ["Custom Data"],
        "summary": "Create Custom Data Record",
        "description": "Create a record in a custom data table.",
        "operationId": "create_custom_data_record_data__table_name__put",
        "security": [{ "APIKeyHeader": [] }],
        "parameters": [
          {
            "name": "table_name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]+$",
              "title": "Table Name"
            },
            "description": "Custom data table name."
          },
          {
            "name": "sourceUpdatedAtColumn",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9_]*$",
              "maxLength": 63
            },
            "description": "Name of a TIMESTAMP column supplied with a non-null value. Atomically apply only if the stored timestamp is null or older. Equal/older values return 409. Ordered PUT also requires a configured business key and its value. Omit for normal write behavior."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/CustomDataRecordPayload" }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Custom Data Record Created",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/CustomDataRecordResponse" }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          },
          "404": {
            "description": "Custom Data Table Not Found",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          },
          "409": {
            "description": "An equal or newer source timestamp already exists, or a unique value conflicts."
          }
        }
      },
      "delete": {
        "tags": ["Custom Data"],
        "summary": "Delete All Custom Data Records",
        "description": "Delete all records from a custom data table without deleting the table schema.",
        "operationId": "delete_all_custom_data_records_data__table_name__delete",
        "security": [{ "APIKeyHeader": [] }],
        "parameters": [
          {
            "name": "table_name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]+$",
              "title": "Table Name"
            },
            "description": "Custom data table name."
          }
        ],
        "responses": {
          "200": {
            "description": "Custom Data Records Deleted",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/DeleteAllCustomDataRecordsResponse" }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          },
          "404": {
            "description": "Custom Data Table Not Found",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          }
        }
      }
    },
    "/data/{table_name}/{id}": {
      "get": {
        "tags": ["Custom Data"],
        "summary": "Get Custom Data Record",
        "description": "Get a single record from a custom data table by record ID.",
        "operationId": "get_custom_data_record_data__table_name___id__get",
        "security": [{ "APIKeyHeader": [] }],
        "parameters": [
          {
            "name": "table_name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]+$",
              "title": "Table Name"
            },
            "description": "Custom data table name."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": { "type": "integer", "title": "ID" },
            "description": "Custom data record ID."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/CustomDataRecordResponse" }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          },
          "404": {
            "description": "Custom Data Table or Record Not Found",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          }
        }
      },
      "patch": {
        "tags": ["Custom Data"],
        "summary": "Update Custom Data Record",
        "description": "Update a record in a custom data table.",
        "operationId": "update_custom_data_record_data__table_name___id__patch",
        "security": [{ "APIKeyHeader": [] }],
        "parameters": [
          {
            "name": "table_name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]+$",
              "title": "Table Name"
            },
            "description": "Custom data table name."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": { "type": "integer", "title": "ID" },
            "description": "Custom data record ID."
          },
          {
            "name": "sourceUpdatedAtColumn",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9_]*$",
              "maxLength": 63
            },
            "description": "Name of a TIMESTAMP column supplied with a non-null value. Atomically apply only if the stored timestamp is null or older. Equal/older values return 409. Ordered PUT also requires a configured business key and its value. Omit for normal write behavior."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/CustomDataRecordPayload" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Custom Data Record Updated",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/CustomDataRecordResponse" }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          },
          "404": {
            "description": "Custom Data Table or Record Not Found",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          },
          "409": {
            "description": "An equal or newer source timestamp already exists, or a unique value conflicts."
          }
        }
      },
      "delete": {
        "tags": ["Custom Data"],
        "summary": "Delete Custom Data Record",
        "description": "Delete one record from a custom data table.",
        "operationId": "delete_custom_data_record_data__table_name___id__delete",
        "security": [{ "APIKeyHeader": [] }],
        "parameters": [
          {
            "name": "table_name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]+$",
              "title": "Table Name"
            },
            "description": "Custom data table name."
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": { "type": "integer", "title": "ID" },
            "description": "Custom data record ID."
          }
        ],
        "responses": {
          "200": {
            "description": "Custom Data Record Deleted",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/DeleteCustomDataRecordResponse" }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          },
          "404": {
            "description": "Custom Data Table or Record Not Found",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "JourneyEnrollRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "idempotencyKey",
          "contact"
        ],
        "properties": {
          "idempotencyKey": {
            "type": "string",
            "maxLength": 255,
            "description": "Your key for this enrollment, such as a lead or appointment id. Sending it again returns the same enrollment."
          },
          "externalId": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 255
              },
              {
                "type": "null"
              }
            ],
            "description": "Another id to cancel by later. Defaults to idempotencyKey. It is also used as the contact's external id when the contact is created or updated."
          },
          "contact": {
            "description": "An existing contact by id, or contact details that are created or updated by phone number.",
            "oneOf": [
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "contactId"
                ],
                "properties": {
                  "contactId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "The contact's id."
                  }
                },
                "title": "Existing contact"
              },
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "phoneNumber"
                ],
                "properties": {
                  "phoneNumber": {
                    "type": "string",
                    "description": "The contact's phone number, ideally in E.164 format."
                  },
                  "name": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "The contact's name."
                  },
                  "email": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "email"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "The contact's email address."
                  },
                  "timezone": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "The contact's IANA time zone, such as America/Chicago. Used for calling hours ahead of the address or area code."
                  },
                  "attributes": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "Contact fields to set."
                  }
                },
                "title": "Contact details"
              }
            ]
          },
          "subject": {
            "type": "object",
            "additionalProperties": true,
            "description": "The record this enrollment is about, such as an appointment. The journey's conditions and texts can read these fields, and calls receive them."
          },
          "params": {
            "type": "object",
            "additionalProperties": true,
            "description": "Extra parameters passed to every call the journey places for this enrollment. They are also merged into subject."
          },
          "subjectKey": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 255
              },
              {
                "type": "null"
              }
            ],
            "description": "Identifies the subject. Defaults to idempotencyKey."
          },
          "anchorAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "The date the journey's steps are timed from, in ISO 8601 with an offset. Overrides the anchor the journey would read from subject."
          },
          "notBefore": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "The earliest time the first call or text may go out. Null means as soon as calling hours allow."
          }
        },
        "title": "Enroll in Journey Request"
      },
      "JourneyCancelRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "idempotencyKey": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 255
              },
              {
                "type": "null"
              }
            ],
            "description": "The key the enrollment was created with. Send this or externalId."
          },
          "externalId": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 255
              },
              {
                "type": "null"
              }
            ],
            "description": "The enrollment's external id. Send this or idempotencyKey."
          },
          "reason": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 500
              },
              {
                "type": "null"
              }
            ],
            "description": "Why the enrollment was cancelled. Shown in the contact's history."
          }
        },
        "title": "Cancel Journey Enrollment Request"
      },
      "JourneyEnrollmentResult": {
        "type": "object",
        "required": [
          "enrollmentId",
          "status",
          "endedReason",
          "skippedReason",
          "created",
          "nextTouchAt",
          "contact"
        ],
        "properties": {
          "enrollmentId": {
            "type": "string",
            "description": "The enrollment's id. Empty when the contact was skipped."
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "ended",
              "skipped"
            ],
            "description": "active while the journey is working the contact, ended once it finished, skipped when the contact could not be enrolled."
          },
          "endedReason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Why the enrollment ended, such as goal_met, opted_out, cancelled, total_cap or exhausted."
          },
          "skippedReason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Why the contact was not enrolled, in words, such as Active in another journey."
          },
          "created": {
            "type": "boolean",
            "description": "True when this request created the enrollment."
          },
          "nextTouchAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "When a call or text is going out right away. Null when the next step is later; it is planned when it comes due."
          },
          "contact": {
            "anyOf": [
              {
                "type": "object",
                "required": [
                  "timezone",
                  "timezoneSource"
                ],
                "properties": {
                  "timezone": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "The time zone used for the contact's calling hours."
                  },
                  "timezoneSource": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Where the time zone came from: confirmed, provided, address or area_code."
                  }
                }
              },
              {
                "type": "null"
              }
            ],
            "description": "The contact's time zone, when known."
          }
        },
        "title": "Journey Enrollment Result"
      },
      "ContactDataRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": ["data"],
        "properties": {
          "data": {
            "type": "object",
            "additionalProperties": true,
            "description": "The JSON object to store. Its serialized UTF-8 size may not exceed 64 KiB."
          },
          "ttlSeconds": {
            "type": "integer",
            "minimum": 60,
            "maximum": 7776000,
            "description": "Optional expiration in seconds. Omit for no expiry; allowed values range from 60 seconds through 90 days."
          }
        },
        "title": "Contact Data Request"
      },
      "ContactDataGetResponse": {
        "type": "object",
        "additionalProperties": { "type": "string" },
        "required": ["phoneNumber"],
        "description": "Your stored fields at the top level, keyed alongside the caller identifier. Every value is a string, no value exceeds 250 characters, and the entire serialized body is kept within 250 characters as well — when the combined payload would overrun that, the longest field is shortened until it fits, longest first, so a prose field absorbs the loss. Values of 64 characters or fewer are never shortened, nor is the caller identifier, because truncating a routing value or status changes its meaning rather than degrading it; a body of only short values is returned over budget instead. IVR platforms consume this response as a flat key-value list and hold each value in a fixed-width string variable (Five9 caps script strings at 250 characters), so stored values longer than that are cut at the last sentence boundary that fits, or truncated at 250 characters when there is no usable boundary. Numbers and booleans are serialized as strings, null and absent values as an empty string, and nested objects and arrays as JSON text. Revision and expiry metadata is not returned here so it does not consume the IVR's character budget; the write endpoints return it.",
        "properties": {
          "phoneNumber": {
            "type": "string",
            "description": "The normalized phone number in E.164 format, or the caller identifier as provided when it is not a phone number."
          }
        },
        "title": "Contact Data Get Response"
      },
      "ContactDataResponse": {
        "type": "object",
        "required": ["phoneNumber", "data", "revision", "ttlSeconds", "expiresAt"],
        "properties": {
          "phoneNumber": {
            "type": "string",
            "description": "The normalized phone number in E.164 format, or the caller identifier as provided when it is not a phone number."
          },
          "data": {
            "type": "object",
            "additionalProperties": true,
            "description": "The stored JSON object."
          },
          "revision": {
            "type": "integer",
            "minimum": 1,
            "description": "The revision number of this value."
          },
          "ttlSeconds": {
            "anyOf": [{ "type": "integer" }, { "type": "null" }],
            "description": "Remaining TTL in seconds, or null when the record has no expiry."
          },
          "expiresAt": {
            "anyOf": [{ "type": "string", "format": "date-time" }, { "type": "null" }],
            "description": "Expiration timestamp in UTC, or null when the record has no expiry."
          }
        },
        "title": "Contact Data Response"
      },
      "DeleteContactResponse": {
        "type": "object",
        "required": ["id", "deleted"],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "The UUID of the deleted contact."
          },
          "deleted": { "type": "boolean", "const": true }
        },
        "title": "Delete Contact Response"
      },
      "DeleteContactDataResponse": {
        "type": "object",
        "required": ["phoneNumber", "deleted"],
        "properties": {
          "phoneNumber": {
            "type": "string",
            "description": "The normalized phone number in E.164 format, or the caller identifier as provided when it is not a phone number."
          },
          "deleted": {
            "type": "boolean",
            "description": "Whether a current value was deleted."
          }
        },
        "title": "Delete Contact Data Response"
      },
      "DeleteSyncedContactFieldResponse": {
        "type": "object",
        "required": ["key", "deleted"],
        "properties": {
          "key": {
            "type": "string",
            "description": "The key of the deleted field."
          },
          "deleted": { "type": "boolean", "const": true }
        },
        "title": "Delete Synced Contact Field Response"
      },
      "ContactConsentInput": {
        "type": "object",
        "additionalProperties": false,
        "required": ["medium", "category", "optOut"],
        "properties": {
          "medium": { "type": "string", "enum": ["voice", "text"] },
          "category": {
            "type": "string",
            "enum": ["all", "transactional", "marketing"]
          },
          "optOut": {
            "anyOf": [{ "type": "boolean" }, { "type": "null" }],
            "description": "True reports an opt-out, false reports no opt-out from this source, and null reports unknown. False is not affirmative consent."
          }
        }
      },
      "ContactConsentRecord": {
        "type": "object",
        "required": ["phoneNumber", "sourceKey", "medium", "category", "status", "observedAt"],
        "properties": {
          "phoneNumber": {
            "type": "string"
          },
          "sourceKey": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Null identifies a decision recorded by Simple."
          },
          "medium": {
            "type": "string",
            "enum": ["voice", "text"]
          },
          "category": {
            "type": "string",
            "enum": ["all", "transactional", "marketing"]
          },
          "status": {
            "type": "string",
            "enum": ["opted_in", "opted_out", "not_opted_out", "unknown"],
            "description": "Any opted_out record blocks the matching communication. not_opted_out does not grant affirmative consent."
          },
          "observedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ListContactsResponse": {
        "type": "object",
        "required": ["data", "hasMore", "nextCursor"],
        "properties": {
          "data": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/SyncedContact" }
          },
          "hasMore": { "type": "boolean" },
          "nextCursor": {
            "anyOf": [{ "type": "string", "format": "uuid" }, { "type": "null" }]
          }
        }
      },
      "ContactSyncSource": {
        "type": "object",
        "additionalProperties": false,
        "required": ["key", "name", "provider"],
        "properties": {
          "key": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63,
            "pattern": "^[a-z][a-z0-9]*(?:_[a-z0-9]+)*$",
            "description": "Stable lowercase snake_case identifier for the source."
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255,
            "description": "Display name for the source."
          },
          "provider": {
            "type": "string",
            "enum": ["salesforce", "shopify", "custom"],
            "description": "The system that owns the synced contact data."
          }
        },
        "title": "Contact Sync Source"
      },
      "ContactSyncFieldDefinition": {
        "type": "object",
        "additionalProperties": false,
        "required": ["label", "type"],
        "properties": {
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255,
            "description": "Display label for the field."
          },
          "description": {
            "anyOf": [{ "type": "string", "maxLength": 2000 }, { "type": "null" }],
            "default": null,
            "description": "Optional explanation of the field."
          },
          "type": {
            "type": "string",
            "enum": ["text", "number", "boolean", "date", "enum", "url", "email", "phone"],
            "description": "Value type enforced for this field. A field's type cannot be changed after creation."
          },
          "enumOptions": {
            "type": "array",
            "maxItems": 100,
            "uniqueItems": true,
            "items": { "type": "string", "minLength": 1, "maxLength": 255 },
            "default": [],
            "description": "Allowed values for an enum field. Required for enum fields and omitted for other types. Existing options cannot be removed."
          }
        },
        "title": "Contact Sync Field Definition"
      },
      "ContactSyncMatch": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "email": {
            "type": "string",
            "format": "email",
            "description": "Lookup-only email used to link this identity to one existing contact."
          },
          "phoneNumber": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255,
            "description": "Lookup-only phone number used to link this identity to one existing contact."
          }
        },
        "default": {},
        "title": "Contact Sync Match"
      },
      "UpsertSyncedContactRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": ["source", "externalId"],
        "properties": {
          "source": {
            "oneOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 63,
                "pattern": "^[a-z][a-z0-9]*(?:_[a-z0-9]+)*$",
                "description": "Stable lowercase snake_case identifier for the source."
              },
              { "$ref": "#/components/schemas/ContactSyncSource" }
            ],
            "description": "A source key reuses or creates a custom source. The object form supplies its display name and provider. Existing metadata is preserved when using a string."
          },
          "fields": {
            "type": "object",
            "propertyNames": {
              "pattern": "^[a-z][a-z0-9]*(?:_[a-z0-9]+)*$",
              "maxLength": 63
            },
            "additionalProperties": {
              "$ref": "#/components/schemas/ContactSyncFieldDefinition"
            },
            "default": {},
            "description": "Field definitions owned by this source. Include them when first used or when labels, descriptions, or enum options change. Define name, email, and phone_number before sending their corresponding top-level values."
          },
          "externalId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1000,
            "description": "Stable contact identifier from the external source."
          },
          "name": {
            "anyOf": [
              { "type": "string", "minLength": 1, "maxLength": 255 },
              { "type": "null" }
            ],
            "description": "Contact name. Omit to leave unchanged or send null to clear it."
          },
          "email": {
            "anyOf": [{ "type": "string", "format": "email" }, { "type": "null" }],
            "description": "Contact email. Omit to leave unchanged or send null to clear it."
          },
          "phoneNumber": {
            "anyOf": [
              { "type": "string", "minLength": 1, "maxLength": 255 },
              { "type": "null" }
            ],
            "description": "Contact phone number. Omit to leave unchanged or send null to clear it."
          },
          "match": { "$ref": "#/components/schemas/ContactSyncMatch" },
          "attributes": {
            "type": "object",
            "propertyNames": {
              "pattern": "^[a-z][a-z0-9]*(?:_[a-z0-9]+)*$",
              "maxLength": 63
            },
            "additionalProperties": true,
            "default": {},
            "description": "Values for non-system fields defined by this source. Values must match their field type. Omit a key to leave it unchanged or send null to clear it."
          },
          "eventId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255,
            "description": "Unique event ID within this source. Supply with sourceUpdatedAt; required for nonempty consents. Retry with the same request body."
          },
          "sourceUpdatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp of the source change, including timezone. Older events for the external identity are skipped. Supply with eventId."
          },
          "consents": {
            "type": "array",
            "maxItems": 6,
            "default": [],
            "items": { "$ref": "#/components/schemas/ContactConsentInput" },
            "description": "Preferences for the supplied primary phoneNumber. Omitted or empty leaves consent unchanged. Duplicate medium/category entries are rejected."
          }
        },
        "title": "Upsert Synced Contact Request",
        "dependentRequired": {
          "eventId": ["sourceUpdatedAt"],
          "sourceUpdatedAt": ["eventId"]
        },
        "allOf": [
          {
            "if": {
              "required": ["consents"],
              "properties": { "consents": { "minItems": 1 } }
            },
            "then": {
              "required": ["phoneNumber", "eventId", "sourceUpdatedAt"],
              "properties": {
                "phoneNumber": {
                  "type": "string",
                  "pattern": "^\\+[1-9]\\d{1,14}$"
                }
              }
            }
          }
        ]
      },
      "ContactExternalIdentity": {
        "type": "object",
        "required": ["sourceKey", "externalId"],
        "properties": {
          "sourceKey": { "type": "string" },
          "externalId": { "type": "string" }
        },
        "title": "Contact External Identity"
      },
      "DerivedContactAttribute": {
        "type": "object",
        "required": ["value", "status", "confidence", "evaluatedAt"],
        "properties": {
          "value": {
            "anyOf": [{ "type": "string" }, { "type": "number" }, { "type": "boolean" }, { "type": "null" }]
          },
          "status": {
            "type": "string",
            "enum": ["ready", "pending", "stale", "failed"]
          },
          "confidence": {
            "anyOf": [{ "type": "number" }, { "type": "null" }]
          },
          "evaluatedAt": {
            "anyOf": [{ "type": "string", "format": "date-time" }, { "type": "null" }]
          }
        },
        "title": "Derived Contact Attribute"
      },
      "SyncedContact": {
        "type": "object",
        "required": [
          "id",
          "name",
          "email",
          "phoneNumber",
          "attributes",
          "derivedAttributes",
          "externalIdentities",
          "consents",
          "isTest"
        ],
        "properties": {
          "id": { "type": "string", "format": "uuid" },
          "name": { "anyOf": [{ "type": "string" }, { "type": "null" }] },
          "email": {
            "anyOf": [{ "type": "string", "format": "email" }, { "type": "null" }]
          },
          "phoneNumber": { "anyOf": [{ "type": "string" }, { "type": "null" }] },
          "isTest": {
            "type": "boolean",
            "description": "True for contacts created as dashboard test identities. Test contacts never merge with production contacts."
          },
          "attributes": {
            "type": "object",
            "additionalProperties": {
              "anyOf": [
                { "type": "string" },
                { "type": "number" },
                { "type": "boolean" },
                { "type": "null" }
              ]
            }
          },
          "derivedAttributes": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/DerivedContactAttribute"
            }
          },
          "externalIdentities": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/ContactExternalIdentity" }
          },
          "consents": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/ContactConsentRecord" },
            "description": "Consent records by source for the current phone number. Empty for contacts without a phone number."
          }
        },
        "title": "Synced Contact"
      },
      "UpsertSyncedContactResponse": {
        "type": "object",
        "required": ["contact", "created", "linked", "applied", "reason"],
        "properties": {
          "contact": { "$ref": "#/components/schemas/SyncedContact" },
          "created": {
            "type": "boolean",
            "description": "True when this request created the Simple contact."
          },
          "linked": {
            "type": "boolean",
            "description": "True when a new external identity was linked to an existing Simple contact."
          },
          "applied": {
            "type": "boolean",
            "description": "False when the request was skipped as a duplicate or stale event."
          },
          "reason": {
            "anyOf": [
              { "type": "string", "enum": ["duplicate", "stale"] },
              { "type": "null" }
            ]
          }
        },
        "title": "Upsert Synced Contact Response"
      },
      "PublicApiError": {
        "type": "object",
        "required": ["status", "success", "error", "errors"],
        "properties": {
          "status": { "type": "string", "const": "error" },
          "success": { "type": "boolean", "const": false },
          "error": { "type": "string" },
          "errors": {
            "type": "array",
            "items": { "type": "string" }
          }
        },
        "title": "Public API Error"
      },
      "UtteranceFeedbackNoteResponse": {
        "type": "object",
        "required": [
          "note_text",
          "created_at"
        ],
        "properties": {
          "author_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Author Name",
            "description": "Display name of the note author"
          },
          "note_text": {
            "type": "string",
            "title": "Note Text",
            "description": "The text content of the note"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At",
            "description": "When the note was created"
          }
        },
        "title": "Utterance Feedback Note Response"
      },
      "UtteranceFeedbackResponse": {
        "type": "object",
        "required": [
          "uuid",
          "transcript_entry_id",
          "feedback_text",
          "resolved",
          "created_at",
          "notes",
          "anchors"
        ],
        "properties": {
          "uuid": {
            "type": "string",
            "format": "uuid",
            "title": "UUID",
            "description": "Unique identifier for the feedback entry"
          },
          "call_id": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "title": "Call ID",
            "description": "UUID of the call the feedback belongs to"
          },
          "transcript_entry_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Transcript Entry ID",
            "description": "Identifier of the first transcript entry (utterance) the feedback was left on; null for feedback on the call as a whole"
          },
          "category": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "wrong_action",
                  "skipped_verification",
                  "incorrect_information",
                  "transfer_handling",
                  "conversation_quality",
                  "data_integration",
                  "transcription_error",
                  "interruption_handling",
                  "tag_error",
                  "other"
                ]
              },
              {
                "type": "null"
              }
            ],
            "title": "Category",
            "description": "Feedback category, auto-assigned when the feedback is created unless the reviewer picked one. Null when not yet categorized."
          },
          "priority": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "critical",
                  "high",
                  "medium",
                  "low"
                ]
              },
              {
                "type": "null"
              }
            ],
            "title": "Priority",
            "description": "Reviewer-assigned priority. Null when the reviewer did not set one."
          },
          "utterance_text": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Utterance Text",
            "description": "Text of the utterance the feedback was left on"
          },
          "utterance_role": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Utterance Role",
            "description": "Speaker role of the utterance (e.g. 'assistant' or 'user')"
          },
          "feedback_text": {
            "type": "string",
            "title": "Feedback Text",
            "description": "The feedback left by the reviewer"
          },
          "corrected_response": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Corrected Response",
            "description": "Suggested corrected response, if one was provided"
          },
          "agent_id": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "title": "Agent ID",
            "description": "UUID of the agent the feedback was recorded against"
          },
          "agent_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Agent Name",
            "description": "Name of the agent at the time the feedback was created"
          },
          "node_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Node Name",
            "description": "Name of the agent node the utterance came from, if known"
          },
          "resolved": {
            "type": "boolean",
            "title": "Resolved",
            "description": "Whether the feedback has been marked as fixed"
          },
          "resolved_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Resolved At",
            "description": "When the feedback was marked as fixed (null if unresolved)"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At",
            "description": "When the feedback was created"
          },
          "submitted_by": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "email": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "title": "Email",
                    "description": "Submitter's email address"
                  },
                  "first_name": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "title": "First Name",
                    "description": "Submitter's first name"
                  },
                  "last_name": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "title": "Last Name",
                    "description": "Submitter's last name"
                  }
                }
              },
              {
                "type": "null"
              }
            ],
            "title": "Submitted By",
            "description": "The user who submitted the feedback (null if unavailable)"
          },
          "notes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UtteranceFeedbackNoteResponse"
            },
            "title": "Notes",
            "description": "Discussion notes attached to the feedback entry"
          },
          "anchors": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "transcript_entry_id",
                "text"
              ],
              "properties": {
                "transcript_entry_id": {
                  "type": "string",
                  "title": "Transcript Entry ID"
                },
                "text": {
                  "type": "string",
                  "title": "Text",
                  "description": "Text of the utterance"
                },
                "role": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "title": "Role",
                  "description": "Who spoke the utterance, e.g. assistant or user"
                }
              },
              "title": "Feedback Anchor"
            },
            "title": "Anchors",
            "description": "Every transcript entry the feedback points at, in conversation order. Empty for feedback on the call as a whole, and for older feedback stored without utterance text (transcript_entry_id is still set for those). Otherwise transcript_entry_id, utterance_text and utterance_role mirror the first anchor."
          }
        },
        "title": "Utterance Feedback Response"
      },
      "AgentCreate": {
        "properties": {
          "prompt": { "type": "string", "title": "Prompt" },
          "available_params": {
            "items": { "type": "string" },
            "type": "array",
            "title": "Available Params",
            "default": []
          },
          "name": { "type": "string", "title": "Name", "default": "Agent" },
          "first_sentence": {
            "type": "string",
            "title": "First Sentence",
            "description": "The first sentence the agent will say when starting a call",
            "default": null
          },
          "language": {
            "type": "string",
            "title": "Language",
            "description": "The language the agent will use for the call",
            "default": "en",
            "enum": ["en", "es", "ar"]
          },
          "record": {
            "type": "boolean",
            "title": "Record",
            "description": "Whether to record the agent's calls",
            "default": false
          },
          "analyzers": {
            "type": "array",
            "title": "Analyzers",
            "description": "List of analyzers to run after each call",
            "items": {
              "type": "object",
              "required": ["prompt", "output_config", "title"],
              "properties": {
                "title": {
                  "type": "string",
                  "title": "Title",
                  "description": "The title of the analyzer"
                },
                "prompt": {
                  "type": "string",
                  "title": "Prompt",
                  "description": "The prompt to use for analysis"
                },
                "output_config": {
                  "type": "object",
                  "title": "Output Config",
                  "description": "Configuration for the expected output format",
                  "required": ["type"],
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["string", "boolean", "datetime", "object"],
                      "description": "The type of output expected"
                    },
                    "properties": {
                      "type": "object",
                      "description": "Required when type is 'object'. Defines the structure of the object",
                      "additionalProperties": {
                        "type": "object",
                        "required": ["type"],
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": ["string", "boolean", "datetime"]
                          }
                        }
                      }
                    }
                  }
                }
              }
            },
            "default": []
          }
        },
        "type": "object",
        "required": ["prompt"],
        "title": "AgentCreate"
      },
      "AgentResponse": {
        "properties": {
          "prompt": { "type": "string", "title": "Prompt" },
          "available_params": {
            "items": { "type": "string" },
            "type": "array",
            "title": "Available Params",
            "default": []
          },
          "name": { "type": "string", "title": "Name", "default": "Agent" },
          "first_sentence": {
            "type": "string",
            "title": "First Sentence",
            "description": "The first sentence the agent will say when starting a call"
          },
          "language": {
            "type": "string",
            "title": "Language",
            "description": "The language the agent uses for calls",
            "enum": ["en", "es"]
          },
          "record": {
            "type": "boolean",
            "title": "Record",
            "description": "Whether the agent's calls are recorded"
          },
          "id": { "type": "string", "format": "uuid", "title": "Id" },
          "organization_id": { "type": "integer", "title": "Organization Id" },
          "user_id": { "type": "integer", "title": "User Id" },
          "analyzers": {
            "type": "array",
            "title": "Analyzers",
            "items": {
              "type": "object",
              "required": ["id", "prompt", "output_config"],
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "title": "Id"
                },
                "prompt": {
                  "type": "string",
                  "title": "Prompt"
                },
                "output_config": {
                  "type": "object",
                  "title": "Output Config"
                }
              }
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "title": "Updated At"
          }
        },
        "type": "object",
        "required": [
          "prompt",
          "id",
          "organization_id",
          "user_id",
          "created_at",
          "updated_at",
          "analyzers"
        ],
        "title": "AgentResponse"
      },
      "AgentUpdate": {
        "properties": {
          "prompt": { "type": "string", "title": "Prompt" },
          "available_params": {
            "items": { "type": "string" },
            "type": "array",
            "title": "Available Params",
            "default": []
          },
          "name": { "type": "string", "title": "Name", "default": "Agent" },
          "first_sentence": {
            "type": "string",
            "title": "First Sentence",
            "description": "The first sentence the agent will say when starting a call",
            "default": null
          },
          "language": {
            "type": "string",
            "title": "Language",
            "description": "The language the agent will use for the call",
            "default": "en",
            "enum": ["en", "es", "ar"]
          },
          "record": {
            "type": "boolean",
            "title": "Record",
            "description": "Whether to record the agent's calls",
            "default": false
          },
          "analyzers": {
            "type": "array",
            "title": "Analyzers",
            "description": "List of analyzers to run after each call. Providing this will replace all existing analyzers.",
            "items": {
              "type": "object",
              "required": ["prompt", "output_config"],
              "properties": {
                "prompt": {
                  "type": "string",
                  "title": "Prompt",
                  "description": "The prompt to use for analysis"
                },
                "output_config": {
                  "type": "object",
                  "title": "Output Config",
                  "description": "Configuration for the expected output format",
                  "required": ["type"],
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["string", "boolean", "datetime", "object"],
                      "description": "The type of output expected"
                    },
                    "properties": {
                      "type": "object",
                      "description": "Required when type is 'object'. Defines the structure of the object",
                      "additionalProperties": {
                        "type": "object",
                        "required": ["type"],
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": ["string", "boolean", "datetime"]
                          }
                        }
                      }
                    }
                  }
                }
              }
            },
            "default": []
          }
        },
        "type": "object",
        "required": ["prompt"],
        "title": "AgentUpdate"
      },
      "InteractionDetailsResponse": {
        "properties": {
          "id": { "type": "string", "format": "uuid", "title": "Id" },
          "type": {
            "type": "string",
            "enum": ["call", "conversation", "email", "sms", "external_channel"],
            "title": "Type",
            "description": "Identifies whether the interaction is a native call/conversation or an external-channel interaction."
          },
          "modality": {
            "anyOf": [
              { "$ref": "#/components/schemas/ModalityEnum" },
              { "type": "null" }
            ],
            "description": "Native interactions return `voice` or `text`. External-channel interactions return `null`."
          },
          "language": {
            "$ref": "#/components/schemas/LanguageEnum"
          },
          "from_number": {
            "anyOf": [
              { "type": "string", "title": "From Number" },
              { "type": "null" }
            ],
            "title": "From Number",
            "description": "Phone number for native interactions. External-channel interactions return `null`."
          },
          "to_number": {
            "anyOf": [
              { "type": "string", "title": "To Number" },
              { "type": "null" }
            ],
            "title": "To Number",
            "description": "Phone number for native interactions. External-channel interactions return `null`."
          },
          "status": { "type": "string", "title": "Status" },
          "transferred": {
            "anyOf": [{ "type": "boolean" }, { "type": "null" }],
            "title": "Transferred",
            "description": "Indicates if the interaction was transferred. External-channel interactions return `null`."
          },
          "handoff_metadata": {
            "anyOf": [
              { "$ref": "#/components/schemas/HandoffMetadata" },
              { "type": "null" }
            ],
            "title": "Handoff Metadata",
            "description": "Metadata about the handoff when the interaction was transferred to an external provider (e.g. Five9). External-channel interactions return `null`."
          },
          "direction": {
            "anyOf": [
              { "type": "string", "title": "Direction" },
              { "type": "null" }
            ],
            "title": "Direction",
            "description": "The direction of the interaction (inbound/outbound). External-channel interactions return `null`."
          },
          "tags": {
            "type": "array",
            "title": "Tags",
            "description": "Tags associated with the interaction",
            "items": {
              "type": "object",
              "properties": {
                "id": { "type": "string", "format": "uuid" },
                "name": { "type": "string" },
                "description": { "type": "string" },
                "color": { "type": "string" }
              }
            }
          },
          "started_at": {
            "anyOf": [
              { "type": "string", "format": "date-time" },
              { "type": "null" }
            ],
            "title": "Started At"
          },
          "ended_at": {
            "anyOf": [
              { "type": "string", "format": "date-time" },
              { "type": "null" }
            ],
            "title": "Ended At"
          },
          "duration": {
            "anyOf": [{ "type": "integer" }, { "type": "null" }],
            "title": "Duration"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At",
            "description": "For native interactions this is the record creation time. For external-channel interactions this is the underlying session's ingestion time. Note: `created_at` sorting and the `created_at_gte`/`created_at_lte` filters order external-channel interactions by their call (leg start) time, not by this ingestion timestamp, so a returned `created_at` value may fall outside the requested filter window."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "title": "Updated At",
            "description": "Time the interaction record was last updated. For external-channel interactions this is the underlying session's last update time."
          },
          "external_identifiers": {
            "anyOf": [
              {
                "type": "object",
                "additionalProperties": { "type": "string" }
              },
              { "type": "null" }
            ],
            "title": "External Identifiers",
            "description": "External identifiers associated with the interaction"
          },
          "params": {
            "anyOf": [
              {
                "type": "object",
                "additionalProperties": { "type": "string" }
              },
              { "type": "null" }
            ],
            "title": "Params",
            "description": "Parameters associated with the interaction"
          },
          "transcripts": {
            "items": {
              "anyOf": [
                { "$ref": "#/components/schemas/CallTranscriptResponse" },
                { "$ref": "#/components/schemas/ExternalChannelTranscriptResponse" }
              ]
            },
            "type": "array",
            "title": "Transcripts",
            "description": "Transcript item shape depends on the interaction `type`."
          },
          "recording_presigned_url": {
            "anyOf": [{ "type": "string" }, { "type": "null" }],
            "title": "Recording Presigned Url",
            "description": "Presigned URL for the recording (for voice modality only). External-channel interactions return `null`."
          },
          "answered_by": {
            "anyOf": [
              { "$ref": "#/components/schemas/AnsweredByEnum" },
              { "type": "null" }
            ],
            "title": "Answered By",
            "description": "Answered-by classification for native voice interactions. External-channel interactions return `null`."
          },
          "analyzers": {
            "type": "array",
            "title": "Analyzers",
            "description": "List of analyzers configured for this interaction",
            "items": {
              "$ref": "#/components/schemas/AnalyzerResponse"
            }
          },
          "analysis_results": {
            "type": "array",
            "title": "Analysis Results",
            "description": "Results from analyzers that have completed",
            "items": {
              "$ref": "#/components/schemas/AnalysisResultResponse"
            }
          },
          "summary": {
            "anyOf": [{ "type": "string" }, { "type": "null" }],
            "title": "Summary",
            "description": "The summary of the interaction if available"
          },
          "recording_presigned_urls": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uri"
            },
            "description": "Presigned URLs for all playable recordings in chronological order. External calls can have multiple recordings per session. URLs expire after one hour. Deleted, excluded, and recordings awaiting required audio redaction are omitted; an empty array means no recordings are currently playable. If URL signing fails for a recording, its URL is omitted and the call data is still returned."
          }
        },
        "type": "object",
        "required": [
          "id",
          "type",
          "status",
          "started_at",
          "created_at",
          "updated_at",
          "transcripts",
          "recording_presigned_urls"
        ],
        "title": "InteractionDetailsResponse"
      },
      "InteractionListResponse": {
        "properties": {
          "interactions": {
            "items": { "$ref": "#/components/schemas/InteractionDetailsResponse" },
            "type": "array",
            "title": "Interactions"
          },
          "total_count": { "type": "integer", "title": "Total Count" },
          "page": { "type": "integer", "title": "Page" },
          "page_size": { "type": "integer", "title": "Page Size" },
          "total_pages": { "type": "integer", "title": "Total Pages" },
          "filters": {
            "type": "object",
            "properties": {
              "status": {
                "anyOf": [{ "type": "string" }, { "type": "null" }],
                "title": "Status"
              },
              "modality": {
                "anyOf": [
                  { "type": "string", "enum": ["voice", "text"] },
                  { "type": "null" }
                ],
                "title": "Modality"
              },
              "agent_id": {
                "anyOf": [
                  { "type": "string", "format": "uuid" },
                  { "type": "null" }
                ],
                "title": "Agent ID"
              },
              "agent_version_id": {
                "anyOf": [
                  { "type": "string", "format": "uuid" },
                  { "type": "null" }
                ],
                "title": "Agent Version ID"
              },
              "transferred": {
                "anyOf": [{ "type": "boolean" }, { "type": "null" }],
                "title": "Transferred"
              },
              "created_at_gte": {
                "anyOf": [
                  { "type": "string", "format": "date-time" },
                  { "type": "null" }
                ],
                "title": "Created At Greater Than or Equal"
              },
              "created_at_lte": {
                "anyOf": [
                  { "type": "string", "format": "date-time" },
                  { "type": "null" }
                ],
                "title": "Created At Less Than or Equal"
              },
              "updated_at_gte": {
                "anyOf": [
                  { "type": "string", "format": "date-time" },
                  { "type": "null" }
                ],
                "title": "Updated At Greater Than or Equal"
              },
              "updated_at_lte": {
                "anyOf": [
                  { "type": "string", "format": "date-time" },
                  { "type": "null" }
                ],
                "title": "Updated At Less Than or Equal"
              }
            },
            "title": "Filters"
          },
          "sorting": {
            "type": "object",
            "properties": {
              "sort_by": { "type": "string", "title": "Sort By" },
              "sort_direction": { "type": "string", "title": "Sort Direction" }
            },
            "title": "Sorting"
          }
        },
        "type": "object",
        "required": [
          "interactions",
          "total_count",
          "page",
          "page_size",
          "total_pages"
        ],
        "title": "InteractionListResponse"
      },
      "CallDetailsResponse": {
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "title": "Id",
            "description": "The call's identifier. Same value as `simple_uuid`."
          },
          "simple_uuid": {
            "type": "string",
            "format": "uuid",
            "title": "Simple Uuid"
          },
          "language": {
            "type": "string",
            "title": "Language",
            "description": "Language code for the call, such as `en` or `es`"
          },
          "from_number": { "type": "string", "title": "From Number" },
          "to_number": { "type": "string", "title": "To Number" },
          "status": {
            "type": "string",
            "enum": ["enqueued", "in_progress", "completed", "failed", "cancelled"],
            "title": "Status",
            "description": "Where the call is in its lifecycle. `completed`, `failed` and `cancelled` are final."
          },
          "transferred": {
            "type": "boolean",
            "title": "Transferred",
            "description": "Indicates if the call was transferred"
          },
          "handoff_metadata": {
            "anyOf": [
              { "$ref": "#/components/schemas/HandoffMetadata" },
              { "type": "null" }
            ],
            "title": "Handoff Metadata",
            "description": "Metadata about the handoff when the call was transferred to an external provider (e.g. Five9). Null if the call was not transferred."
          },
          "direction": {
            "type": "string",
            "enum": ["inbound", "outbound"],
            "title": "Direction",
            "description": "The direction of the call"
          },
          "tags": {
            "type": "array",
            "title": "Tags",
            "description": "Tags associated with the call",
            "items": {
              "type": "object",
              "properties": {
                "id": { "type": "string", "format": "uuid" },
                "name": { "type": "string" },
                "description": { "type": "string" },
                "color": { "type": "string" }
              }
            }
          },
          "voice_id": {
            "anyOf": [
              { "type": "string", "format": "uuid" },
              { "type": "null" }
            ],
            "title": "Voice ID",
            "description": "The ID of the voice used for the call"
          },
          "agent_speaks_first": {
            "anyOf": [{ "type": "boolean" }, { "type": "null" }],
            "title": "Agent Speaks First",
            "description": "Whether the agent speaks first in the call"
          },
          "agent_id": {
            "anyOf": [
              { "type": "string", "format": "uuid" },
              { "type": "null" }
            ],
            "title": "Agent ID",
            "description": "The ID of the agent used for the call. Null when the call is not associated with an agent."
          },
          "agent_branch": {
            "anyOf": [
              { "type": "string", "format": "uuid" },
              { "type": "null" }
            ],
            "title": "Agent Branch",
            "description": "The ID of the agent version used for the call. Null when the call is not associated with an agent."
          },
          "agent_commit_id": {
            "anyOf": [
              { "type": "string", "format": "uuid" },
              { "type": "null" }
            ],
            "title": "Agent Commit ID",
            "description": "The ID of the specific agent version snapshot used for the call. Null when the call is not associated with an agent."
          },
          "agent_branch_name": {
            "anyOf": [{ "type": "string" }, { "type": "null" }],
            "title": "Agent Branch Name",
            "description": "The name of the agent version used for the call. Null when the call is not associated with an agent."
          },
          "started_at": {
            "anyOf": [
              { "type": "string", "format": "date-time" },
              { "type": "null" }
            ],
            "title": "Started At"
          },
          "ended_at": {
            "anyOf": [
              { "type": "string", "format": "date-time" },
              { "type": "null" }
            ],
            "title": "Ended At"
          },
          "duration": {
            "anyOf": [{ "type": "integer" }, { "type": "null" }],
            "title": "Duration"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At",
            "description": "For native interactions this is the record creation time. For external-channel interactions this is the underlying session's ingestion time. Note: `created_at` sorting and the `created_at_gte`/`created_at_lte` filters order external-channel interactions by their call (leg start) time, not by this ingestion timestamp, so a returned `created_at` value may fall outside the requested filter window."
          },
          "external_identifiers": {
            "anyOf": [
              {
                "type": "object",
                "additionalProperties": { "type": "string" }
              },
              { "type": "null" }
            ],
            "title": "External Identifiers",
            "description": "External identifiers associated with the call"
          },
          "params": {
            "anyOf": [
              { "type": "object", "additionalProperties": true },
              { "type": "null" }
            ],
            "title": "Params",
            "description": "Parameters associated with the call"
          },
          "transcripts": {
            "items": { "$ref": "#/components/schemas/CallTranscriptResponse" },
            "type": "array",
            "title": "Transcripts"
          },
          "recording_presigned_url": {
            "anyOf": [{ "type": "string" }, { "type": "null" }],
            "title": "Recording Presigned Url"
          },
          "screen_pop_token": {
            "type": "string",
            "title": "Screen Pop Token",
            "description": "Opens this call's screen pop page at `/screen-pop#<token>`. It expires four hours after the call started."
          },
          "cart": {
            "anyOf": [
              {
                "type": "object",
                "title": "Cart",
                "properties": {
                  "value": {
                    "title": "Value",
                    "description": "The final value of the call parameter the agent stores its cart in, exactly as the agent saved it."
                  },
                  "checkout": {
                    "anyOf": [
                      {
                        "type": "object",
                        "title": "Checkout",
                        "description": "Set when the order was placed during the call; null when the cart was never placed.",
                        "properties": {
                          "order_ids": {
                            "anyOf": [{ "type": "array", "items": { "type": "string" } }, { "type": "null" }],
                            "title": "Order Ids",
                            "description": "Order ids read from the outputs of the action that placed the order, when the agent's cart settings say where they are."
                          }
                        },
                        "required": ["order_ids"]
                      },
                      { "type": "null" }
                    ],
                    "title": "Checkout"
                  }
                },
                "required": ["value", "checkout"]
              },
              { "type": "null" }
            ],
            "title": "Cart",
            "description": "The call's cart, when the agent version it ran on has a cart configured. Null otherwise."
          },
          "call_prompt": {
            "anyOf": [{ "type": "string" }, { "type": "null" }],
            "title": "Call Prompt"
          },
          "answered_by": {
            "anyOf": [
              { "$ref": "#/components/schemas/AnsweredByEnum" },
              { "type": "null" }
            ]
          },
          "analyzers": {
            "type": "array",
            "title": "Analyzers",
            "description": "List of analyzers configured for this call",
            "items": {
              "$ref": "#/components/schemas/AnalyzerResponse"
            }
          },
          "analysis_results": {
            "type": "array",
            "title": "Analysis Results",
            "description": "Results from analyzers that have completed",
            "items": {
              "$ref": "#/components/schemas/AnalysisResultResponse"
            }
          },
          "summary": {
            "anyOf": [{ "type": "string" }, { "type": "null" }],
            "title": "Summary",
            "description": "The summary of the call if available"
          },
          "keyterms": {
            "type": "array",
            "items": { "type": "string" },
            "title": "Keyterms",
            "description": "Key terms configured for the agent used on the call. Empty when there is no associated agent or no key terms are configured."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp when this call was last updated."
          }
        },
        "type": "object",
        "required": [
          "id",
          "simple_uuid",
          "from_number",
          "to_number",
          "status",
          "started_at",
          "ended_at",
          "duration",
          "created_at",
          "transcripts",
          "call_prompt",
          "answered_by",
          "screen_pop_token",
          "updated_at"
        ],
        "title": "CallDetailsResponse"
      },
      "CallListResponse": {
        "properties": {
          "calls": {
            "items": { "$ref": "#/components/schemas/CallDetailsResponse" },
            "type": "array",
            "title": "Calls"
          },
          "total_count": { "type": "integer", "title": "Total Count" },
          "page": { "type": "integer", "title": "Page" },
          "page_size": { "type": "integer", "title": "Page Size" },
          "total_pages": { "type": "integer", "title": "Total Pages" },
          "filters": {
            "type": "object",
            "properties": {
              "status": {
                "anyOf": [{ "type": "string" }, { "type": "null" }],
                "title": "Status"
              },
              "agent_id": {
                "anyOf": [
                  { "type": "string", "format": "uuid" },
                  { "type": "null" }
                ],
                "title": "Agent ID"
              },
              "agent_version_id": {
                "anyOf": [
                  { "type": "string", "format": "uuid" },
                  { "type": "null" }
                ],
                "title": "Agent Version ID"
              },
              "transferred": {
                "anyOf": [{ "type": "boolean" }, { "type": "null" }],
                "title": "Transferred"
              },
              "created_at_gte": {
                "anyOf": [
                  { "type": "string", "format": "date-time" },
                  { "type": "null" }
                ],
                "title": "Created At Greater Than or Equal"
              },
              "created_at_lte": {
                "anyOf": [
                  { "type": "string", "format": "date-time" },
                  { "type": "null" }
                ],
                "title": "Created At Less Than or Equal"
              },
              "updated_at_gte": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Lower inclusive update-time bound used for this request, or null when omitted."
              },
              "updated_at_lte": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Upper inclusive update-time bound used for this request, or null when omitted."
              }
            },
            "title": "Filters"
          },
          "sorting": {
            "type": "object",
            "properties": {
              "sort_by": { "type": "string", "title": "Sort By" },
              "sort_direction": { "type": "string", "title": "Sort Direction" }
            },
            "title": "Sorting"
          }
        },
        "type": "object",
        "required": [
          "calls",
          "total_count",
          "page",
          "page_size",
          "total_pages"
        ],
        "title": "CallListResponse"
      },
      "CallFindByAttributeResponse": {
        "properties": {
          "success": {
            "type": "boolean",
            "title": "Success",
            "description": "Indicates if the request was successful"
          },
          "call": {
            "oneOf": [
              { "$ref": "#/components/schemas/CallDetailsResponse" },
              { "$ref": "#/components/schemas/ProjectedCallDetailsResponse" }
            ],
            "description": "The full call details when fields is omitted, or only the requested fields when fields is provided"
          }
        },
        "type": "object",
        "required": ["success", "call"],
        "title": "CallFindByAttributeResponse"
      },
      "ProjectedCallDetailsResponse": {
        "properties": {
          "id": { "type": "string", "format": "uuid", "title": "Id" },
          "summary": {
            "anyOf": [{ "type": "string" }, { "type": "null" }],
            "title": "Summary"
          },
          "status": { "type": "string", "title": "Status" },
          "duration": {
            "anyOf": [{ "type": "integer" }, { "type": "null" }],
            "title": "Duration"
          },
          "transferred": { "type": "boolean", "title": "Transferred" },
          "agent_id": {
            "anyOf": [
              { "type": "string", "format": "uuid" },
              { "type": "null" }
            ],
            "title": "Agent Id"
          },
          "agent_commit_id": {
            "anyOf": [
              { "type": "string", "format": "uuid" },
              { "type": "null" }
            ],
            "title": "Agent Commit Id"
          },
          "screen_pop_token": {
            "type": "string",
            "title": "Screen Pop Token",
            "description": "Opens this call's screen pop page at `/screen-pop#<token>`. It expires four hours after the call started."
          },
          "cart": {
            "anyOf": [
              {
                "type": "object",
                "title": "Cart",
                "properties": {
                  "value": {
                    "title": "Value",
                    "description": "The final value of the call parameter the agent stores its cart in, exactly as the agent saved it."
                  },
                  "checkout": {
                    "anyOf": [
                      {
                        "type": "object",
                        "title": "Checkout",
                        "description": "Set when the order was placed during the call; null when the cart was never placed.",
                        "properties": {
                          "order_ids": {
                            "anyOf": [{ "type": "array", "items": { "type": "string" } }, { "type": "null" }],
                            "title": "Order Ids",
                            "description": "Order ids read from the outputs of the action that placed the order, when the agent's cart settings say where they are."
                          }
                        },
                        "required": ["order_ids"]
                      },
                      { "type": "null" }
                    ],
                    "title": "Checkout"
                  }
                },
                "required": ["value", "checkout"]
              },
              { "type": "null" }
            ],
            "title": "Cart",
            "description": "The call's cart, when the agent version it ran on has a cart configured. Null otherwise."
          },
          "params": {
            "type": "object",
            "additionalProperties": true,
            "title": "Params"
          }
        },
        "type": "object",
        "minProperties": 1,
        "additionalProperties": false,
        "title": "ProjectedCallDetailsResponse"
      },
      "CallPromptResponse": {
        "properties": {
          "prompt_text": { "type": "string", "title": "Prompt Text" },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At"
          }
        },
        "type": "object",
        "required": ["prompt_text", "created_at"],
        "title": "CallPromptResponse"
      },
      "CallRequest": {
        "properties": {
          "to_number": {
            "type": "string",
            "title": "To Number",
            "description": "The phone number to call in E.164 format",
            "examples": ["+12345678900"]
          },
          "from_number_id": {
            "type": "string",
            "format": "uuid",
            "title": "Phone Number ID",
            "description": "The UUID of the phone number to use for the outbound call. If not provided, a phone number will be automatically selected.",
            "examples": ["123e4567-e89b-12d3-a456-426614174000"]
          },
          "record": {
            "type": "boolean",
            "title": "Record",
            "description": "Whether to record the call or not",
            "default": false
          },
          "language": {
            "type": "string",
            "title": "Language",
            "description": "Language code for the call, such as `en` or `es`. Defaults to the agent's language when `agent_id` is provided, otherwise `en`.",
            "examples": ["en"]
          },
          "prompt": {
            "anyOf": [{ "type": "string" }, { "type": "null" }],
            "title": "Prompt",
            "description": "The prompt to use for the AI call. Required if agent_id is not provided",
            "examples": ["Hello, I'm calling to confirm your appointment"]
          },
          "boost_keywords": {
            "anyOf": [
              { "items": { "type": "string" }, "type": "array" },
              { "type": "null" }
            ],
            "title": "Boost Keywords",
            "description": "Keywords to emphasize during the conversation",
            "examples": [["appointment", "schedule", "morning"]]
          },
          "agent_id": {
            "anyOf": [
              { "type": "string", "format": "uuid" },
              { "type": "null" }
            ],
            "title": "Agent Id",
            "description": "ID of the pre-configured agent to handle the call. Required if prompt is not provided. Cannot be used together with prompt or analyzers - use the agent's analyzers instead.",
            "examples": ["123e4567-e89b-12d3-a456-426614174000"]
          },
          "version_id": {
            "anyOf": [
              { "type": "string", "format": "uuid" },
              { "type": "null" }
            ],
            "title": "Version Id",
            "description": "When using agent_id, specifies which agent version to use. If not provided, uses the most recently updated version.",
            "examples": ["456e7890-e89b-12d3-a456-426614174000"]
          },
          "params": {
            "anyOf": [
              { "additionalProperties": true, "type": "object" },
              { "type": "null" }
            ],
            "title": "Params",
            "description": "Additional parameters to pass to the call. These will be substituted into the prompt for all keys with {{params.key}}",
            "examples": [
              { "appointment_type": "morning", "customer_id": "123456" }
            ]
          },
          "external_identifiers": {
            "anyOf": [
              {
                "additionalProperties": { "type": "string" },
                "type": "object"
              },
              { "type": "null" }
            ],
            "title": "External Identifiers",
            "description": "External identifiers to associate with the call. These can be used to find the call later using the find_by_attribute endpoint.",
            "examples": [
              { "customer_id": "CUST-123456", "order_id": "ORD-789012" }
            ]
          },
          "analyzers": {
            "anyOf": [
              {
                "type": "array",
                "title": "Analyzers",
                "description": "List of analyzers to run after the call. Can only be provided when agent_id is not provided. If using an agent, use the agent's analyzers instead.",
                "items": {
                  "type": "object",
                  "required": ["prompt", "output_config"],
                  "properties": {
                    "prompt": {
                      "type": "string",
                      "title": "Prompt",
                      "description": "The prompt to use for analysis"
                    },
                    "output_config": {
                      "type": "object",
                      "title": "Output Config",
                      "description": "Configuration for the expected output format",
                      "required": ["type"],
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": ["string", "boolean", "datetime", "object"],
                          "description": "The type of output expected"
                        },
                        "properties": {
                          "type": "object",
                          "description": "Required when type is 'object'. Defines the structure of the object",
                          "additionalProperties": {
                            "type": "object",
                            "required": ["type"],
                            "properties": {
                              "type": {
                                "type": "string",
                                "enum": ["string", "boolean", "datetime"]
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              { "type": "null" }
            ],
            "default": null
          },
          "voice_id": {
            "anyOf": [
              { "type": "string", "format": "uuid" },
              { "type": "null" }
            ],
            "title": "Voice Id",
            "description": "The UUID of the voice to use for this call. Overrides the agent's default voice when provided.",
            "examples": ["789e0123-e89b-12d3-a456-426614174000"]
          },
          "idempotency_key": {
            "anyOf": [{ "type": "string" }, { "type": "null" }],
            "title": "Idempotency Key",
            "description": "Optional idempotency key for safe retries. Reusing the same key with the same JSON request body returns the original call response; reusing it with a different body returns 409 conflict.",
            "examples": ["call-create-2026-03-04-0001"]
          }
        },
        "type": "object",
        "required": ["to_number"],
        "title": "Call Request",
        "description": "Request to initiate an AI phone call",
        "oneOf": [
          {
            "required": ["prompt"],
            "not": { "required": ["agent_id"] }
          },
          {
            "required": ["agent_id"],
            "not": {
              "anyOf": [
                { "required": ["prompt"] },
                { "required": ["analyzers"] }
              ]
            }
          }
        ]
      },
      "CallCreateConflictResponse": {
        "properties": {
          "success": {
            "type": "boolean",
            "title": "Success"
          },
          "errors": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Errors"
          }
        },
        "type": "object",
        "required": ["success", "errors"],
        "title": "CallCreateConflictResponse"
      },
      "CallResponse": {
        "properties": {
          "success": { "type": "boolean", "title": "Success" },
          "status": {
            "type": "string",
            "enum": ["enqueued", "cancelled"],
            "title": "Status",
            "description": "`enqueued` when a call is created, `cancelled` when it is cancelled"
          },
          "uuid": {
            "type": "string",
            "format": "uuid",
            "title": "Uuid",
            "description": "The call's identifier. Use it with the other call endpoints."
          }
        },
        "type": "object",
        "required": ["success", "status", "uuid"],
        "title": "CallResponse"
      },
      "CallTranscriptResponse": {
        "properties": {
          "text": {
            "anyOf": [{ "type": "string" }, { "type": "null" }],
            "title": "Text"
          },
          "role": {
            "anyOf": [{ "type": "string" }, { "type": "null" }],
            "title": "Role"
          },
          "timestamp": {
            "type": "number",
            "title": "Timestamp",
            "description": "When the entry was recorded, as a Unix timestamp in seconds"
          },
          "function_name": {
            "anyOf": [{ "type": "string" }, { "type": "null" }],
            "title": "Function Name"
          },
          "arguments": {
            "anyOf": [{ "type": "object" }, { "type": "null" }],
            "title": "Arguments"
          }
        },
        "type": "object",
        "required": ["text", "role", "timestamp", "function_name", "arguments"],
        "title": "CallTranscriptResponse"
      },
      "ExternalChannelTranscriptResponse": {
        "properties": {
          "speaker": {
            "type": "string",
            "title": "Speaker"
          },
          "text": {
            "type": "string",
            "title": "Text"
          },
          "start": {
            "type": "number",
            "title": "Start"
          },
          "end": {
            "type": "number",
            "title": "End"
          },
          "confidence": {
            "type": "number",
            "title": "Confidence"
          },
          "channel": {
            "type": "string",
            "title": "Channel"
          }
        },
        "type": "object",
        "required": ["speaker", "text", "start", "end", "confidence"],
        "title": "ExternalChannelTranscriptResponse"
      },
      "CallNoteRequest": {
        "type": "object",
        "required": ["score"],
        "properties": {
          "note": {
            "type": "string",
            "title": "Note",
            "description": "The text content of the note"
          },
          "score": {
            "type": "string",
            "enum": ["good", "room_for_improvement", "unrated"],
            "title": "Score",
            "description": "The score/rating for the call"
          }
        },
        "title": "Call Note Request"
      },
      "CallNoteResponse": {
        "type": "object",
        "required": ["id", "score", "user", "created_at", "updated_at"],
        "properties": {
          "id": {
            "type": "integer",
            "title": "ID",
            "description": "Unique identifier for the call note"
          },
          "note": {
            "anyOf": [{ "type": "string" }, { "type": "null" }],
            "title": "Note",
            "description": "The text content of the note"
          },
          "score": {
            "type": "string",
            "enum": ["good", "room_for_improvement", "unrated"],
            "title": "Score",
            "description": "The score/rating for the call"
          },
          "user": {
            "type": "object",
            "title": "User",
            "description": "The user who created the note. If created via API without a user, first_name will be 'API' and other fields will be null.",
            "properties": {
              "id": {
                "anyOf": [{ "type": "string", "format": "uuid" }, { "type": "null" }],
                "title": "ID",
                "description": "User's unique identifier (null for API-created notes)"
              },
              "email": {
                "anyOf": [{ "type": "string" }, { "type": "null" }],
                "title": "Email",
                "description": "User's email address (null for API-created notes)"
              },
              "first_name": {
                "type": "string",
                "title": "First Name",
                "description": "User's first name or 'API' for API-created notes"
              },
              "last_name": {
                "anyOf": [{ "type": "string" }, { "type": "null" }],
                "title": "Last Name",
                "description": "User's last name (null for API-created notes)"
              }
            },
            "required": ["first_name"]
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At",
            "description": "When the note was created"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "title": "Updated At",
            "description": "When the note was last updated"
          }
        },
        "title": "Call Note Response"
      },
      "CallTagRequest": {
        "type": "object",
        "required": ["name", "description", "color"],
        "properties": {
          "name": {
            "type": "string",
            "title": "Name",
            "description": "The name of the call tag"
          },
          "description": {
            "type": "string",
            "title": "Description",
            "description": "A description of what this tag represents"
          },
          "color": {
            "type": "string",
            "title": "Color",
            "description": "A hex color code for the tag (e.g., #FF5733)",
            "pattern": "^#[0-9A-Fa-f]{6}$"
          },
          "always_enabled": {
            "type": "boolean",
            "title": "Always Enabled",
            "description": "Whether this tag is always enabled for all calls",
            "default": false
          }
        },
        "title": "Call Tag Request"
      },
      "CallTagResponse": {
        "type": "object",
        "required": ["id", "uuid", "name", "description", "color", "always_enabled", "created_at", "updated_at"],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "title": "ID",
            "description": "Unique identifier for the call tag"
          },
          "uuid": {
            "type": "string",
            "format": "uuid",
            "title": "UUID",
            "description": "Unique identifier for the call tag"
          },
          "name": {
            "type": "string",
            "title": "Name",
            "description": "The name of the call tag"
          },
          "description": {
            "type": "string",
            "title": "Description",
            "description": "A description of what this tag represents"
          },
          "color": {
            "type": "string",
            "title": "Color",
            "description": "A hex color code for the tag"
          },
          "always_enabled": {
            "type": "boolean",
            "title": "Always Enabled",
            "description": "Whether this tag is always enabled for all calls"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At",
            "description": "When the tag was created"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "title": "Updated At",
            "description": "When the tag was last updated"
          }
        },
        "title": "Call Tag Response"
      },
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": { "$ref": "#/components/schemas/ValidationError" },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "ValidationError": {
        "properties": {
          "loc": {
            "items": { "anyOf": [{ "type": "string" }, { "type": "integer" }] },
            "type": "array",
            "title": "Location"
          },
          "msg": { "type": "string", "title": "Message" },
          "type": { "type": "string", "title": "Error Type" }
        },
        "type": "object",
        "required": ["loc", "msg", "type"],
        "title": "ValidationError"
      },
      "PhoneNumberResponse": {
        "type": "object",
        "properties": {
          "id": { "type": "string", "format": "uuid" },
          "number": { "type": "string" },
          "friendly_name": { "type": "string" },
          "area_code": { "type": "string" },
          "country": { "type": "string" },
          "agent": {
            "type": "object",
            "properties": {
              "id": { "type": "integer" },
              "name": { "type": "string" },
              "uuid": { "type": "string", "format": "uuid" }
            }
          },
          "created_at": { "type": "string", "format": "date-time" },
          "updated_at": { "type": "string", "format": "date-time" }
        },
        "required": [
          "id",
          "number",
          "friendly_name",
          "area_code",
          "country",
          "status",
          "active",
          "created_at",
          "updated_at"
        ],
        "title": "PhoneNumberResponse"
      },
      "AvailableNumberResponse": {
        "type": "object",
        "properties": {
          "phone_number": { "type": "string" },
          "friendly_name": { "type": "string" },
          "address_requirements": { "type": "string" },
          "region": { "type": "string" },
          "country": { "type": "string" }
        },
        "required": [
          "phone_number",
          "friendly_name",
          "address_requirements",
          "region",
          "country"
        ],
        "title": "AvailableNumberResponse"
      },
      "LanguageEnum": {
        "type": "string",
        "enum": ["en", "es", "ar"],
        "title": "Language",
        "description": "The language to use for the call - English (en) or Spanish (es)"
      },
      "ModalityEnum": {
        "type": "string",
        "enum": ["voice", "text"],
        "title": "Modality",
        "description": "The modality of the interaction - voice calls or text conversations"
      },
      "AnsweredByEnum": {
        "type": "string",
        "enum": ["voicemail", "human", "no_answer", "unknown"],
        "title": "Answered By",
        "description": "Indicates how the call was answered - by a human, voicemail, or if there was no answer"
      },
      "AnalyzerResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "title": "Id",
            "description": "Unique identifier for the analyzer"
          },
          "prompt": {
            "type": "string",
            "title": "Prompt",
            "description": "The prompt used for analysis"
          },
          "output_config": {
            "type": "object",
            "title": "Output Config",
            "description": "Configuration for the expected output format",
            "properties": {
              "type": {
                "type": "string",
                "enum": ["string", "boolean", "datetime", "object"],
                "description": "The type of output expected"
              },
              "properties": {
                "type": "object",
                "description": "Required when type is 'object'. Defines the structure of the object",
                "additionalProperties": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["string", "boolean", "datetime"]
                    }
                  }
                }
              }
            }
          }
        },
        "required": ["id", "prompt", "output_config"],
        "title": "AnalyzerResponse"
      },
      "AnalysisResultResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "title": "Id",
            "description": "Unique identifier for the analysis result"
          },
          "analyzer_id": {
            "type": "string",
            "format": "uuid",
            "title": "Analyzer Id",
            "description": "Identifier of the analyzer that produced this result"
          },
          "prompt": {
            "type": "string",
            "title": "Prompt",
            "description": "The prompt used for analysis"
          },
          "output_config": {
            "type": "object",
            "title": "Output Config",
            "description": "Configuration for the expected output format"
          },
          "result": {
            "type": "object",
            "title": "Result",
            "description": "The analysis result, structure depends on the output_config"
          }
        },
        "required": ["id", "analyzer_id", "prompt", "output_config", "result"],
        "title": "AnalysisResultResponse"
      },
      "WebhookRequest": {
        "type": "object",
        "required": ["url"],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri",
            "title": "URL",
            "description": "The URL where webhook events will be sent"
          },
          "event_types": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "call.started",
                "call.completed",
                "call.transferred",
                "call.transcript_update",
                "external_call.ingested",
                "external_call.transcribed"
              ]
            },
            "title": "Event Types",
            "description": "The types of events to subscribe to. If not specified, all event types will be included."
          },
          "description": {
            "type": "string",
            "title": "Description",
            "description": "Optional description for the webhook endpoint"
          },
          "disabled": {
            "type": "boolean",
            "title": "Disabled",
            "description": "Whether the webhook is initially disabled",
            "default": false
          },
          "rate_limit": {
            "type": "integer",
            "title": "Rate Limit",
            "description": "Optional cap on deliveries per second to this webhook"
          }
        },
        "title": "Webhook Request"
      },
      "WebhookResponse": {
        "type": "object",
        "required": ["endpoint_id", "url", "event_types", "created_at"],
        "properties": {
          "endpoint_id": {
            "type": "string",
            "title": "Endpoint ID",
            "description": "Unique identifier for the webhook endpoint"
          },
          "url": {
            "type": "string",
            "format": "uri",
            "title": "URL",
            "description": "The URL where webhook events will be sent"
          },
          "event_types": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "call.started",
                "call.completed",
                "call.transferred",
                "call.transcript_update",
                "external_call.ingested",
                "external_call.transcribed"
              ]
            },
            "title": "Event Types",
            "description": "The types of events the webhook is subscribed to"
          },
          "description": {
            "type": "string",
            "title": "Description",
            "description": "Description of the webhook endpoint"
          },
          "disabled": {
            "type": "boolean",
            "title": "Disabled",
            "description": "Whether the webhook is disabled"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At",
            "description": "When the webhook endpoint was created"
          }
        },
        "title": "Webhook Response"
      },
      "VoiceResponse": {
        "type": "object",
        "required": [
          "id",
          "name",
          "languages",
          "organization_id",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "title": "ID",
            "description": "Unique identifier for the voice"
          },
          "name": {
            "type": "string",
            "title": "Name",
            "description": "Name of the voice"
          },
          "description": {
            "anyOf": [{ "type": "string" }, { "type": "null" }],
            "title": "Description",
            "description": "Description of the voice"
          },
          "languages": {
            "type": "array",
            "items": { "type": "string" },
            "title": "Languages",
            "description": "List of supported languages for this voice"
          },
          "tags": {
            "type": "array",
            "items": { "type": "string" },
            "title": "Tags",
            "description": "Tags associated with the voice"
          },
          "organization_id": {
            "type": "integer",
            "title": "Organization ID",
            "description": "ID of the organization that owns this voice"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At",
            "description": "When the voice was created"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "title": "Updated At",
            "description": "When the voice was last updated"
          }
        },
        "title": "Voice Response"
      },
      "CustomDataColumnType": {
        "type": "string",
        "enum": [
          "STRING",
          "NUMERIC",
          "BOOLEAN",
          "JSONB",
          "TIMESTAMP",
          "REFERENCE",
          "STRING_ARRAY",
          "NUMERIC_ARRAY",
          "BOOLEAN_ARRAY",
          "TIMESTAMP_ARRAY",
          "OBJECT"
        ],
        "title": "Custom Data Column Type"
      },
      "CustomDataColumnInput": {
        "type": "object",
        "required": ["name", "type", "displayName"],
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 63,
            "pattern": "^[a-z]([a-z0-9]+(_[a-z0-9]+)*)?$",
            "title": "Name",
            "description": "Column identifier. Use lowercase letters, numbers, and underscores."
          },
          "type": {
            "$ref": "#/components/schemas/CustomDataColumnType"
          },
          "displayName": {
            "type": "string",
            "title": "Display Name",
            "description": "Human-readable column name shown in Simple AI."
          },
          "referenceTable": {
            "anyOf": [{ "type": "string" }, { "type": "null" }],
            "title": "Reference Table",
            "description": "Required for REFERENCE columns. Use a custom table name or a supported system reference table such as calls."
          },
          "jsonSchema": {
            "anyOf": [
              { "type": "object", "additionalProperties": true },
              { "type": "null" }
            ],
            "title": "JSON Schema",
            "description": "Required for OBJECT columns. Provide an OpenAPI/JSON Schema object that describes the structured value."
          }
        },
        "title": "Custom Data Column Input"
      },
      "CustomDataColumn": {
        "type": "object",
        "required": [
          "id",
          "name",
          "type",
          "displayName",
          "referenceTable",
          "jsonSchema",
          "position"
        ],
        "properties": {
          "id": {
            "type": "integer",
            "title": "ID"
          },
          "name": {
            "type": "string",
            "title": "Name"
          },
          "type": {
            "$ref": "#/components/schemas/CustomDataColumnType"
          },
          "displayName": {
            "type": "string",
            "title": "Display Name"
          },
          "referenceTable": {
            "anyOf": [{ "type": "string" }, { "type": "null" }],
            "title": "Reference Table"
          },
          "jsonSchema": {
            "anyOf": [
              { "type": "object", "additionalProperties": true },
              { "type": "null" }
            ],
            "title": "JSON Schema"
          },
          "position": {
            "type": "integer",
            "title": "Position"
          }
        },
        "title": "Custom Data Column"
      },
      "CustomDataTableCreate": {
        "type": "object",
        "required": ["name", "label", "columns"],
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[a-z]([a-z0-9]+(_[a-z0-9]+)*)?$",
            "title": "Name",
            "description": "Stable table identifier used in record endpoint paths."
          },
          "label": {
            "type": "string",
            "title": "Label",
            "description": "Human-readable table name shown in Simple AI."
          },
          "searchIndexingEnabled": {
            "type": "boolean",
            "title": "Search Indexing Enabled",
            "description": "Whether this table can be searched with the custom data search and facets endpoints.",
            "default": false
          },
          "columns": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/CustomDataColumnInput" },
            "minItems": 1,
            "title": "Columns"
          }
        },
        "title": "Custom Data Table Create"
      },
      "CustomDataTableUpdate": {
        "type": "object",
        "required": ["label", "columns"],
        "properties": {
          "label": {
            "type": "string",
            "title": "Label",
            "description": "Human-readable table name shown in Simple AI."
          },
          "searchIndexingEnabled": {
            "type": "boolean",
            "title": "Search Indexing Enabled",
            "description": "Whether this table can be searched with the custom data search and facets endpoints."
          },
          "columns": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/CustomDataColumnInput" },
            "minItems": 1,
            "title": "Columns"
          }
        },
        "title": "Custom Data Table Update"
      },
      "CustomDataTable": {
        "type": "object",
        "required": [
          "id",
          "name",
          "label",
          "searchIndexingEnabled",
          "columns",
          "recordCount",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "id": {
            "type": "integer",
            "title": "ID"
          },
          "name": {
            "type": "string",
            "title": "Name"
          },
          "label": {
            "type": "string",
            "title": "Label"
          },
          "searchIndexingEnabled": {
            "type": "boolean",
            "title": "Search Indexing Enabled"
          },
          "columns": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/CustomDataColumn" },
            "title": "Columns"
          },
          "recordCount": {
            "type": "integer",
            "title": "Record Count"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "title": "Created At"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "title": "Updated At"
          }
        },
        "title": "Custom Data Table"
      },
      "AvailableReferenceTable": {
        "type": "object",
        "required": ["name", "displayName"],
        "properties": {
          "name": {
            "type": "string",
            "title": "Name"
          },
          "displayName": {
            "type": "string",
            "title": "Display Name"
          }
        },
        "title": "Available Reference Table"
      },
      "CustomDataRecord": {
        "type": "object",
        "required": ["id", "organization_id", "created_at", "updated_at"],
        "properties": {
          "id": {
            "type": "integer",
            "title": "ID"
          },
          "organization_id": {
            "type": "integer",
            "title": "Organization ID"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "title": "Updated At"
          }
        },
        "additionalProperties": true,
        "title": "Custom Data Record"
      },
      "CustomDataRecordPayload": {
        "type": "object",
        "additionalProperties": true,
        "minProperties": 1,
        "title": "Custom Data Record Payload",
        "description": "Object containing values for declared table columns. Managed columns and unknown columns are ignored."
      },
      "CustomDataRecordResponse": {
        "type": "object",
        "required": ["record"],
        "properties": {
          "record": {
            "$ref": "#/components/schemas/CustomDataRecord"
          }
        },
        "title": "Custom Data Record Response"
      },
      "CustomDataRecordListResponse": {
        "type": "object",
        "required": ["records", "total_count", "page", "per_page"],
        "properties": {
          "records": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/CustomDataRecord" },
            "title": "Records"
          },
          "total_count": {
            "type": "integer",
            "title": "Total Count"
          },
          "page": {
            "type": "integer",
            "title": "Page"
          },
          "per_page": {
            "type": "integer",
            "title": "Per Page"
          }
        },
        "title": "Custom Data Record List Response"
      },
      "DeleteCustomDataRecordResponse": {
        "type": "object",
        "required": ["success", "message"],
        "properties": {
          "success": {
            "type": "boolean",
            "default": true
          },
          "message": {
            "type": "string",
            "title": "Message"
          }
        },
        "title": "Delete Custom Data Record Response"
      },
      "DeleteAllCustomDataRecordsResponse": {
        "type": "object",
        "required": ["success", "message", "deleted_count"],
        "properties": {
          "success": {
            "type": "boolean",
            "default": true
          },
          "message": {
            "type": "string",
            "title": "Message"
          },
          "deleted_count": {
            "type": "integer",
            "title": "Deleted Count"
          }
        },
        "title": "Delete All Custom Data Records Response"
      },
      "DeleteCustomDataTableResponse": {
        "type": "object",
        "required": ["success"],
        "properties": {
          "success": {
            "type": "boolean",
            "default": true
          }
        },
        "title": "Delete Custom Data Table Response"
      },
      "CustomDataQueryRequest": {
        "type": "object",
        "required": ["tableName"],
        "properties": {
          "tableName": {
            "type": "string",
            "pattern": "^[a-z0-9_]+$",
            "title": "Table Name",
            "description": "The indexed custom data table to query."
          },
          "filters": {
            "type": "array",
            "title": "Filters",
            "description": "Exact-match filters. Each filter matches a column against one or more values (any-of). An empty filter is ignored.",
            "items": {
              "type": "object",
              "required": ["column", "values"],
              "properties": {
                "column": { "type": "string", "pattern": "^[a-z0-9_]+$", "title": "Column" },
                "values": {
                  "type": "array",
                  "title": "Values",
                  "items": {
                    "anyOf": [{ "type": "string" }, { "type": "number" }, { "type": "boolean" }]
                  }
                }
              }
            }
          },
          "text": {
            "type": "string",
            "maxLength": 5000,
            "title": "Text",
            "description": "Optional free-text search across all columns."
          },
          "size": {
            "type": "integer",
            "minimum": 0,
            "maximum": 50,
            "title": "Size",
            "description": "Max records to return (default 25, max 50)."
          },
          "from": {
            "type": "integer",
            "minimum": 0,
            "title": "From",
            "description": "Offset for pagination."
          }
        },
        "title": "Custom Data Query Request"
      },
      "CustomDataQueryResponse": {
        "type": "object",
        "required": ["records", "total"],
        "properties": {
          "records": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            },
            "title": "Records"
          },
          "total": {
            "type": "integer",
            "title": "Total",
            "description": "Total number of records matching the query (may exceed the returned page)."
          }
        },
        "title": "Custom Data Query Response"
      },
      "CustomDataFacetValue": {
        "type": "object",
        "required": ["value", "count"],
        "properties": {
          "value": {
            "anyOf": [
              { "type": "string" },
              { "type": "number" },
              { "type": "boolean" }
            ],
            "title": "Value"
          },
          "count": {
            "type": "integer",
            "title": "Count"
          }
        },
        "title": "Custom Data Facet Value"
      },
      "CustomDataColumnFacet": {
        "type": "object",
        "required": ["columnName", "columnDisplayName", "columnType", "values"],
        "properties": {
          "columnName": {
            "type": "string",
            "title": "Column Name"
          },
          "columnDisplayName": {
            "type": "string",
            "title": "Column Display Name"
          },
          "columnType": {
            "$ref": "#/components/schemas/CustomDataColumnType"
          },
          "values": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/CustomDataFacetValue" },
            "title": "Values"
          }
        },
        "title": "Custom Data Column Facet"
      },
      "CustomDataFacetsResponse": {
        "type": "object",
        "required": ["tableName", "tableLabel", "totalRecords", "facets"],
        "properties": {
          "tableName": {
            "type": "string",
            "title": "Table Name"
          },
          "tableLabel": {
            "type": "string",
            "title": "Table Label"
          },
          "totalRecords": {
            "type": "integer",
            "title": "Total Records"
          },
          "facets": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/CustomDataColumnFacet" },
            "title": "Facets"
          }
        },
        "title": "Custom Data Facets Response"
      },
      "ExternalCallUploadRequest": {
        "type": "object",
        "required": ["file_name", "file_size_bytes", "content_type"],
        "properties": {
          "file_name": { "type": "string", "minLength": 1, "maxLength": 512 },
          "file_size_bytes": { "type": "integer", "minimum": 1, "maximum": 524288000 },
          "content_type": { "type": "string", "minLength": 1, "maxLength": 255 }
        },
        "title": "External Call Upload Request"
      },
      "ExternalCallUploadResponse": {
        "type": "object",
        "required": ["upload_url", "object_key", "expires_in"],
        "properties": {
          "upload_url": { "type": "string", "format": "uri" },
          "object_key": { "type": "string" },
          "expires_in": { "type": "integer", "description": "Seconds until the upload URL expires." }
        },
        "title": "External Call Upload Response"
      },
      "CreateExternalCallRequest": {
        "type": "object",
        "required": ["object_key", "file_name"],
        "properties": {
          "object_key": {
            "type": "string",
            "description": "The object_key returned by POST /external_calls/upload_url."
          },
          "file_name": { "type": "string", "minLength": 1, "maxLength": 512 }
        },
        "title": "Create External Call Request"
      },
      "ExternalCallSource": {
        "type": "object",
        "required": ["id", "name", "provider"],
        "properties": {
          "id": { "type": "string", "format": "uuid" },
          "name": { "type": "string" },
          "provider": { "type": "string" }
        },
        "title": "External Call Source"
      },
      "ExternalCallTranscriptUtterance": {
        "type": "object",
        "required": ["speaker", "text", "start", "end", "confidence", "channel"],
        "properties": {
          "speaker": { "type": "string" },
          "text": { "type": "string" },
          "start": { "type": "number", "description": "Start time in milliseconds." },
          "end": { "type": "number", "description": "End time in milliseconds." },
          "confidence": { "type": "number" },
          "channel": { "anyOf": [{ "type": "string" }, { "type": "null" }] }
        },
        "title": "External Call Transcript Utterance"
      },
      "ExternalCallRecording": {
        "type": "object",
        "required": [
          "id",
          "file_name",
          "status",
          "started_at",
          "transcript",
          "summary",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": { "type": "string", "format": "uuid" },
          "file_name": { "type": "string" },
          "status": { "type": "string", "enum": ["pending", "transcribing", "transcribed", "error"] },
          "started_at": { "type": "string", "format": "date-time" },
          "transcript": {
            "anyOf": [
              { "type": "array", "items": { "$ref": "#/components/schemas/ExternalCallTranscriptUtterance" } },
              { "type": "null" }
            ]
          },
          "summary": { "anyOf": [{ "type": "string" }, { "type": "null" }] },
          "created_at": { "type": "string", "format": "date-time" },
          "updated_at": { "type": "string", "format": "date-time" }
        },
        "title": "External Call Recording"
      },
      "ExternalCallSummary": {
        "type": "object",
        "required": [
          "id",
          "external_call_id",
          "title",
          "direction",
          "from_number",
          "to_number",
          "duration_seconds",
          "started_at",
          "status",
          "recording_count",
          "source",
          "created_at",
          "updated_at",
          "recording_presigned_urls"
        ],
        "properties": {
          "id": { "type": "string", "format": "uuid" },
          "external_call_id": { "type": "string" },
          "title": { "anyOf": [{ "type": "string" }, { "type": "null" }] },
          "direction": {
            "anyOf": [{ "type": "string", "enum": ["inbound", "outbound"] }, { "type": "null" }]
          },
          "from_number": { "anyOf": [{ "type": "string" }, { "type": "null" }] },
          "to_number": { "anyOf": [{ "type": "string" }, { "type": "null" }] },
          "duration_seconds": { "anyOf": [{ "type": "integer" }, { "type": "null" }] },
          "started_at": { "type": "string", "format": "date-time" },
          "status": { "type": "string", "enum": ["processing", "transcribed", "error"] },
          "recording_count": { "type": "integer", "minimum": 0 },
          "source": {
            "anyOf": [{ "$ref": "#/components/schemas/ExternalCallSource" }, { "type": "null" }]
          },
          "created_at": { "type": "string", "format": "date-time" },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "recording_presigned_urls": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uri"
            },
            "description": "Presigned URLs for all playable recordings in chronological order. External calls can have multiple recordings per session. URLs expire after one hour. Deleted, excluded, and recordings awaiting required audio redaction are omitted; an empty array means no recordings are currently playable. If URL signing fails for a recording, its URL is omitted and the call data is still returned."
          }
        },
        "title": "External Call Summary"
      },
      "ExternalCallDetails": {
        "allOf": [
          { "$ref": "#/components/schemas/ExternalCallSummary" },
          {
            "type": "object",
            "required": ["recordings"],
            "properties": {
              "recordings": {
                "type": "array",
                "items": { "$ref": "#/components/schemas/ExternalCallRecording" }
              }
            }
          }
        ],
        "title": "External Call Details"
      },
      "ExternalCallCreateResponse": {
        "type": "object",
        "required": ["success", "external_call"],
        "properties": {
          "success": { "type": "boolean", "const": true },
          "external_call": { "$ref": "#/components/schemas/ExternalCallDetails" }
        },
        "title": "External Call Create Response"
      },
      "ExternalCallListResponse": {
        "type": "object",
        "required": ["external_calls", "total_count", "page", "page_size", "total_pages"],
        "properties": {
          "external_calls": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/ExternalCallSummary" }
          },
          "total_count": { "type": "integer", "minimum": 0 },
          "page": { "type": "integer", "minimum": 1 },
          "page_size": { "type": "integer", "minimum": 1, "maximum": 100 },
          "total_pages": { "type": "integer", "minimum": 0 }
        },
        "title": "External Call List Response"
      },
      "ErrorResponse": {
        "type": "object",
        "required": ["status", "success", "error", "errors"],
        "properties": {
          "status": {
            "type": "string",
            "default": "error"
          },
          "success": {
            "type": "boolean",
            "default": false
          },
          "error": {
            "type": "string",
            "title": "Error"
          },
          "errors": {
            "type": "array",
            "items": { "type": "string" },
            "title": "Errors"
          }
        },
        "title": "Error Response"
      },
      "HandoffMetadata": {
        "type": "object",
        "title": "HandoffMetadata",
        "description": "Metadata about a transfer to an external provider.",
        "properties": {
          "five9": {
            "anyOf": [
              { "$ref": "#/components/schemas/Five9HandoffMetadata" },
              { "type": "null" }
            ],
            "title": "Five9",
            "description": "Five9 handoff details. Present when the transfer was to Five9."
          }
        }
      },
      "Five9HandoffMetadata": {
        "type": "object",
        "title": "Five9HandoffMetadata",
        "description": "Details of a transfer to Five9.",
        "properties": {
          "conversation_id": {
            "type": "string",
            "title": "Conversation ID",
            "description": "The Five9 conversation ID. Use this to correlate with Five9's API."
          },
          "tenant_name": {
            "anyOf": [{ "type": "string" }, { "type": "null" }],
            "title": "Tenant Name",
            "description": "The Five9 tenant name used for the transfer."
          },
          "campaign_name": {
            "anyOf": [{ "type": "string" }, { "type": "null" }],
            "title": "Campaign Name",
            "description": "The Five9 campaign the conversation was routed to."
          },
          "transferred_at": {
            "anyOf": [
              { "type": "string", "format": "date-time" },
              { "type": "null" }
            ],
            "title": "Transferred At",
            "description": "When the transfer occurred (ISO 8601)."
          }
        }
      }
    },
    "securitySchemes": {
      "APIKeyHeader": {
        "type": "http",
        "scheme": "bearer",
        "description": "Your API key, sent as `Authorization: Bearer YOUR_API_KEY`"
      }
    }
  }
}
