{
  "openapi": "3.1.0",
  "info": {
    "title": "Nixflex API",
    "version": "1.0.0",
    "description": "Voice AI infrastructure: AI phone agents, outbound campaigns, SMS, and browser calls. Bring your own Twilio or Telnyx number; Nixflex runs the conversation.\n\nAuthenticate every request with `Authorization: Bearer KEY_ID:KEY_SECRET` - both halves of your key joined by a colon.\n\nOfficial Node.js SDK: https://www.npmjs.com/package/nixflex",
    "contact": {
      "name": "Nixflex support",
      "email": "support@nixflex.com",
      "url": "https://docs.nixflex.com"
    }
  },
  "servers": [
    {
      "url": "https://api.nixflex.com/v1",
      "description": "Production"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "Agents",
      "description": "The AI personality that answers calls. One agent can serve unlimited phone numbers."
    },
    {
      "name": "Calls",
      "description": "Place outbound calls, read call history and transcripts, erase call data."
    },
    {
      "name": "Campaigns",
      "description": "Voice batch campaigns with scheduling windows."
    },
    {
      "name": "SMS",
      "description": "Single messages and bulk campaigns."
    },
    {
      "name": "Phone numbers",
      "description": "Import numbers you own from Twilio or Telnyx and configure them per number."
    },
    {
      "name": "Account",
      "description": "API keys, usage, and account deletion."
    },
    {
      "name": "Integrations",
      "description": "Per-number webhooks, booking, toggles, and custom functions."
    },
    {
      "name": "Caller context",
      "description": "What your agent knows about each caller on one of your numbers."
    }
  ],
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Your full credential, both halves joined by a colon: `Bearer nxf_xxx:nxfs_xxx`."
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "description": "Every error uses this envelope. Branch on error.code, not on the message text.",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "example": "invalid_request_error"
              },
              "code": {
                "type": "string",
                "example": "missing_field"
              },
              "message": {
                "type": "string",
                "example": "agent_id is required."
              },
              "doc_url": {
                "type": "string",
                "example": "https://docs.nixflex.com/errors/missing_field"
              },
              "details": {
                "type": "object",
                "additionalProperties": true
              }
            },
            "required": [
              "type",
              "code",
              "message"
            ]
          }
        },
        "required": [
          "error"
        ]
      },
      "Agent": {
        "type": "object",
        "description": "An agent is the personality that answers calls. One agent can be attached to unlimited phone numbers. See https://docs.nixflex.com/api-reference/agents/get for the full field list.",
        "properties": {
          "agent_id": {
            "type": "string",
            "example": "agent_f2b06c0e0bd877e9"
          },
          "name": {
            "type": "string",
            "example": "Acme Dental Receptionist"
          },
          "system_prompt": {
            "type": "string"
          },
          "welcome_message": {
            "type": "string"
          },
          "voice_id": {
            "type": "string"
          },
          "language": {
            "type": "string",
            "example": "en"
          },
          "record_call": {
            "type": "boolean"
          },
          "dtmf_enabled": {
            "type": "boolean"
          },
          "voicemail_leave_enabled": {
            "type": "boolean",
            "description": "When true, the agent speaks voicemail_message on answering machines and hangs up. Applies to dashboard-imported numbers; API-imported numbers use their own per-number setting. Enabling without a message is rejected with voicemail_message_required."
          },
          "voicemail_message": {
            "type": "string",
            "nullable": true,
            "description": "Spoken word for word on a detected voicemail when voicemail_leave_enabled is true."
          },
          "speaking_rate": {
            "type": "number"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "incall_sms_enabled": {
            "type": "boolean",
            "default": false,
            "description": "Lets the agent text the caller during a call, and sends booking confirmations by text. Off: no text is sent, the agent confirms details out loud. Agents created before this setting existed were switched on."
          }
        },
        "additionalProperties": true
      },
      "AgentCreate": {
        "type": "object",
        "description": "Only name and system_prompt matter to get started; everything else has a sensible default. Full field list: https://docs.nixflex.com/api-reference/agents/create",
        "properties": {
          "name": {
            "type": "string",
            "example": "Acme Dental Receptionist"
          },
          "system_prompt": {
            "type": "string",
            "maxLength": 16000,
            "example": "You are the front-desk assistant at Acme Dental..."
          },
          "welcome_message": {
            "type": "string",
            "example": "Hello, Acme Dental, how can I help?"
          },
          "voice_id": {
            "type": "string"
          },
          "language": {
            "type": "string",
            "example": "en"
          },
          "record_call": {
            "type": "boolean"
          },
          "dtmf_enabled": {
            "type": "boolean"
          },
          "speaking_rate": {
            "type": "number"
          },
          "incall_sms_enabled": {
            "type": "boolean",
            "default": false,
            "description": "Lets the agent text the caller during a call, and sends booking confirmations by text. Off: no text is sent, the agent confirms details out loud. Agents created before this setting existed were switched on."
          }
        },
        "required": [
          "name"
        ],
        "additionalProperties": true
      },
      "Call": {
        "type": "object",
        "description": "A call record. Post-call fields (transcript, summary, recording) populate after the call ends. Full field list: https://docs.nixflex.com/api-reference/calls/get",
        "properties": {
          "call_id": {
            "type": "string",
            "example": "CA1b5c0bfad4b56635b773938f16db2db7"
          },
          "agent_id": {
            "type": "string"
          },
          "direction": {
            "type": "string",
            "enum": [
              "inbound",
              "outbound"
            ]
          },
          "call_status": {
            "type": "string",
            "example": "completed"
          },
          "duration_ms": {
            "type": "integer",
            "description": "Time the call was connected, in milliseconds. Billing is based on this."
          },
          "ended_reason": {
            "type": "string",
            "example": "completed",
            "description": "Why the call ended: completed, transferred, voicemail_detected, silence_timeout, ivr_timeout, max_duration_reached, caller_hangup (inbound), callee_hangup (outbound), busy / failed / no-answer / canceled (carrier words), concurrency_limit, or a rare infrastructure ending."
          },
          "charged_minutes": {
            "type": "number",
            "description": "Minutes actually charged. Transfers stop the meter at handoff, so this can be less than the recording length."
          },
          "transcript": {
            "type": "string",
            "nullable": true
          },
          "summary": {
            "type": "string",
            "nullable": true
          },
          "sentiment": {
            "type": "string",
            "nullable": true
          },
          "successful": {
            "type": "boolean",
            "nullable": true
          },
          "recording_url": {
            "type": "string",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": true
      },
      "OutboundCallCreate": {
        "type": "object",
        "description": "Places an outbound call. Note the field is to_number (a single SMS uses \"to\" instead).",
        "properties": {
          "agent_id": {
            "type": "string"
          },
          "to_number": {
            "type": "string",
            "example": "+447386172392"
          },
          "prompt": {
            "type": "string",
            "description": "Instructions for this specific call, layered on the agent prompt."
          },
          "dynamic_vars": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Values for {placeholders} in the prompt."
          },
          "from_number": {
            "type": "string",
            "description": "Which of your imported numbers to dial from. Defaults to the agent number."
          }
        },
        "required": [
          "agent_id",
          "to_number"
        ],
        "additionalProperties": true
      },
      "CallDeleteResponse": {
        "type": "object",
        "properties": {
          "call_id": {
            "type": "string"
          },
          "deleted": {
            "type": "boolean"
          },
          "recording_deleted": {
            "type": "boolean",
            "description": "False when the call had no recording; the record is still deleted."
          }
        }
      },
      "CallDeleteAllResponse": {
        "type": "object",
        "properties": {
          "deleted": {
            "type": "boolean"
          },
          "calls_deleted": {
            "type": "integer"
          },
          "recordings_deleted": {
            "type": "integer"
          },
          "sms_deleted": {
            "type": "integer"
          }
        }
      },
      "PhoneNumber": {
        "type": "object",
        "properties": {
          "phone_number": {
            "type": "string",
            "example": "+447446466847"
          },
          "agent_id": {
            "type": "string"
          },
          "provider": {
            "type": "string",
            "enum": [
              "twilio",
              "telnyx"
            ]
          },
          "inbound_enabled": {
            "type": "boolean"
          },
          "outbound_enabled": {
            "type": "boolean"
          },
          "custom_prompt": {
            "type": "string",
            "nullable": true
          },
          "voice_id": {
            "type": "string",
            "nullable": true
          },
          "sms_reply_enabled": {
            "type": "boolean"
          },
          "voicemail_leave_enabled": {
            "type": "boolean",
            "nullable": true,
            "description": "This number's own voicemail setting - the ONLY one that applies to API-imported numbers. null = not set = silent hangup on voicemail."
          },
          "voicemail_message": {
            "type": "string",
            "nullable": true
          },
          "sms_prompt": {
            "type": "string",
            "nullable": true
          },
          "web_prompt": {
            "type": "string",
            "nullable": true
          },
          "speaking_rate": {
            "type": "number",
            "nullable": true
          },
          "dtmf_enabled": {
            "type": "boolean",
            "nullable": true
          },
          "record_call": {
            "type": "boolean",
            "nullable": true
          }
        },
        "additionalProperties": true
      },
      "PhoneNumberImport": {
        "type": "object",
        "description": "The carrier is inferred from which credentials you send: Twilio (twilio_sid + twilio_token) or Telnyx (telnyx_api_key + telnyx_connection_id). Importing a Twilio number REPLACES that number's existing webhooks.",
        "properties": {
          "phone_number": {
            "type": "string",
            "example": "+447446466847"
          },
          "agent_id": {
            "type": "string"
          },
          "twilio_sid": {
            "type": "string"
          },
          "twilio_token": {
            "type": "string"
          },
          "telnyx_api_key": {
            "type": "string"
          },
          "telnyx_connection_id": {
            "type": "string",
            "description": "The ID of a TeXML Application you created in your Telnyx portal."
          },
          "custom_prompt": {
            "type": "string",
            "maxLength": 8000
          }
        },
        "required": [
          "phone_number",
          "agent_id"
        ]
      },
      "PhoneNumberUpdate": {
        "type": "object",
        "description": "Send only the fields that change; an empty body is rejected. null clears a field so the agent setting is inherited - note speaking_rate: null means INHERIT (send 1 to force normal speed).",
        "properties": {
          "custom_prompt": {
            "type": "string",
            "nullable": true,
            "maxLength": 8000
          },
          "voice_id": {
            "type": "string",
            "nullable": true
          },
          "sms_reply_enabled": {
            "type": "boolean"
          },
          "voicemail_leave_enabled": {
            "type": "boolean",
            "nullable": true,
            "description": "Enabling without voicemail_message (here or already saved) is rejected with voicemail_message_required. null clears the setting."
          },
          "voicemail_message": {
            "type": "string",
            "nullable": true,
            "maxLength": 2000
          },
          "sms_prompt": {
            "type": "string",
            "nullable": true,
            "maxLength": 20000
          },
          "web_prompt": {
            "type": "string",
            "nullable": true,
            "maxLength": 20000
          },
          "speaking_rate": {
            "type": "number",
            "nullable": true
          },
          "dtmf_enabled": {
            "type": "boolean",
            "nullable": true
          },
          "record_call": {
            "type": "boolean",
            "nullable": true
          }
        },
        "minProperties": 1
      },
      "SmsSend": {
        "type": "object",
        "description": "Sends one SMS. This endpoint uses \"to\" - not to_number, which is the outbound-call field.",
        "properties": {
          "agent_id": {
            "type": "string"
          },
          "to": {
            "type": "string",
            "example": "+447386172392"
          },
          "message": {
            "type": "string",
            "description": "Keep under about 600 characters for reliable delivery."
          },
          "from_number": {
            "type": "string"
          },
          "context": {
            "type": "object",
            "properties": {
              "reply_context": {
                "type": "string"
              }
            }
          }
        },
        "required": [
          "agent_id",
          "to",
          "message"
        ]
      },
      "SmsCampaign": {
        "type": "object",
        "properties": {
          "campaign_id": {
            "type": "string"
          },
          "agent_id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "from_number": {
            "type": "string"
          },
          "message_template": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "scheduled",
              "running",
              "done",
              "failed"
            ]
          },
          "total_count": {
            "type": "integer"
          },
          "delivered_count": {
            "type": "integer",
            "description": "Carrier-confirmed handset delivery only."
          },
          "failed_count": {
            "type": "integer"
          },
          "pending_count": {
            "type": "integer"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": true
      },
      "SmsCampaignCreate": {
        "type": "object",
        "description": "The from_number can be on either carrier - Twilio or Telnyx. The campaign sends using that number's own credentials, so it must be a number on your account.",
        "properties": {
          "agent_id": {
            "type": "string"
          },
          "from_number": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "message_template": {
            "type": "string",
            "example": "Hi {{name}}, your check-up is due."
          },
          "recipients": {
            "type": "array",
            "maxItems": 10000,
            "items": {
              "type": "object",
              "properties": {
                "phone": {
                  "type": "string"
                },
                "variables": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "string"
                  }
                }
              },
              "required": [
                "phone"
              ]
            }
          },
          "schedule_type": {
            "type": "string",
            "enum": [
              "now",
              "schedule"
            ]
          },
          "scheduled_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "agent_id",
          "from_number",
          "name",
          "message_template",
          "recipients",
          "schedule_type"
        ]
      },
      "BatchCampaignCreate": {
        "type": "object",
        "description": "A voice batch campaign. Scheduling times are interpreted in the campaign timezone. Full field list: https://docs.nixflex.com/api-reference/calls/batch-create",
        "properties": {
          "agent_id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "timezone": {
            "type": "string",
            "example": "Europe/London"
          },
          "recipients": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "phone": {
                  "type": "string"
                },
                "variables": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "string"
                  }
                }
              },
              "required": [
                "phone"
              ]
            }
          },
          "schedule_type": {
            "type": "string",
            "enum": [
              "now",
              "schedule"
            ]
          },
          "scheduled_date": {
            "type": "string",
            "format": "date",
            "example": "2026-06-15"
          },
          "window_start_minutes": {
            "type": "integer",
            "description": "Calling window start, minutes since midnight (540 = 9:00am)."
          },
          "window_end_minutes": {
            "type": "integer",
            "description": "Calling window end, minutes since midnight (1080 = 6:00pm)."
          },
          "window_days": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "mon",
                "tue",
                "wed",
                "thu",
                "fri",
                "sat",
                "sun"
              ]
            }
          }
        },
        "required": [
          "agent_id",
          "recipients"
        ],
        "additionalProperties": true
      },
      "Usage": {
        "type": "object",
        "description": "All-time usage and current limits. Takes no parameters.",
        "properties": {
          "plan": {
            "type": "string",
            "example": "pay_as_you_go"
          },
          "total_calls": {
            "type": "integer"
          },
          "total_minutes": {
            "type": "number",
            "description": "Fractional minutes, e.g. 551.54."
          },
          "total_cost": {
            "type": "number",
            "description": "Nixflex charges in USD. Carrier costs are billed to you directly by Twilio or Telnyx."
          },
          "rate_limit_per_minute": {
            "type": "integer"
          },
          "max_concurrent": {
            "type": "integer"
          },
          "peak_concurrent_this_month": {
            "type": "integer"
          },
          "rejected_at_cap_this_month": {
            "type": "integer",
            "description": "Calls refused because the concurrency cap was reached. Above zero means you are losing calls."
          }
        }
      },
      "KeyResponse": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string"
          },
          "key_id": {
            "type": "string",
            "example": "nxf_a1b2c3..."
          },
          "key_secret": {
            "type": "string",
            "description": "Shown once. Store it immediately."
          }
        }
      },
      "UrlConfig": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri",
            "example": "https://api.yourapp.com/nixflex"
          }
        },
        "required": [
          "url"
        ]
      },
      "ToggleConfig": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean"
          }
        },
        "required": [
          "enabled"
        ]
      },
      "CustomFunction": {
        "type": "object",
        "description": "A custom function lets the agent call your own HTTPS endpoint mid-call. Limit 15 per number. Full field list: https://docs.nixflex.com/api-reference/integrations/custom-functions",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "method": {
            "type": "string",
            "enum": [
              "GET",
              "POST",
              "PUT",
              "PATCH",
              "DELETE"
            ]
          },
          "headers": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "parameters": {
            "type": "object",
            "additionalProperties": true
          },
          "timeout_ms": {
            "type": "integer",
            "minimum": 1000,
            "maximum": 45000,
            "default": 5000
          },
          "speak_during": {
            "type": "string",
            "description": "What the agent says while the function runs."
          }
        },
        "additionalProperties": true
      },
      "CallerContextSet": {
        "type": "object",
        "description": "Send at least one field. Omitted fields keep their value; null removes a field.",
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 120,
            "nullable": true,
            "description": "Full name - first and last."
          },
          "email": {
            "type": "string",
            "format": "email",
            "maxLength": 120,
            "nullable": true
          },
          "phone": {
            "type": "string",
            "maxLength": 40,
            "nullable": true,
            "description": "A contact number other than the one they call from."
          },
          "location": {
            "type": "string",
            "maxLength": 120,
            "nullable": true,
            "description": "Free text - city, area or postal code."
          },
          "reference_id": {
            "type": "string",
            "maxLength": 64,
            "nullable": true,
            "description": "An account, order or booking reference the caller uses."
          },
          "preference": {
            "type": "string",
            "maxLength": 200,
            "nullable": true,
            "example": "prefers morning appointments"
          }
        }
      },
      "CallerContext": {
        "type": "object",
        "properties": {
          "phone_number": {
            "type": "string"
          },
          "caller_number": {
            "type": "string"
          },
          "context": {
            "type": "object",
            "description": "Only fields with a value are present.",
            "properties": {
              "name": {
                "type": "string",
                "maxLength": 120,
                "nullable": true,
                "description": "Full name - first and last."
              },
              "email": {
                "type": "string",
                "format": "email",
                "maxLength": 120,
                "nullable": true
              },
              "phone": {
                "type": "string",
                "maxLength": 40,
                "nullable": true,
                "description": "A contact number other than the one they call from."
              },
              "location": {
                "type": "string",
                "maxLength": 120,
                "nullable": true,
                "description": "Free text - city, area or postal code."
              },
              "reference_id": {
                "type": "string",
                "maxLength": 64,
                "nullable": true,
                "description": "An account, order or booking reference the caller uses."
              },
              "preference": {
                "type": "string",
                "maxLength": 200,
                "nullable": true,
                "example": "prefers morning appointments"
              },
              "last_call": {
                "type": "string",
                "readOnly": true,
                "description": "Engine-written. What the caller wanted on their last call - never what happened."
              },
              "open_item": {
                "type": "string",
                "readOnly": true,
                "description": "Engine-written. Something still pending for the caller."
              }
            }
          }
        }
      }
    }
  },
  "paths": {
    "/agents": {
      "post": {
        "tags": [
          "Agents"
        ],
        "summary": "Create an agent",
        "operationId": "createAgent",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created agent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Agent"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Agents"
        ],
        "summary": "List agents",
        "operationId": "listAgents",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Active agents, newest first. Returns a bare array.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 100,
              "maximum": 200
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Agent"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/agents/{id}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "tags": [
          "Agents"
        ],
        "summary": "Get an agent",
        "operationId": "getAgent",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Agent"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Agents"
        ],
        "summary": "Update an agent",
        "operationId": "updateAgent",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentCreate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Agent"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Agents"
        ],
        "summary": "Delete an agent",
        "operationId": "deleteAgent",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/calls": {
      "get": {
        "tags": [
          "Calls"
        ],
        "summary": "List calls",
        "operationId": "listCalls",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Your calls, newest first. Returns a bare array.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 50,
              "maximum": 200
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Call"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Calls"
        ],
        "summary": "Delete all call data",
        "operationId": "deleteAllCalls",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Permanently erases every call, recording, and SMS message on this key. Irreversible.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CallDeleteAllResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/calls/{id}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "tags": [
          "Calls"
        ],
        "summary": "Get a call",
        "operationId": "getCall",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Call"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Calls"
        ],
        "summary": "Delete a call",
        "operationId": "deleteCall",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Permanently erases the call record, transcript, and recording file. Irreversible.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CallDeleteResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/calls/outbound": {
      "post": {
        "tags": [
          "Calls"
        ],
        "summary": "Create an outbound call",
        "operationId": "createOutboundCall",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Queues the call and returns immediately - it does not wait for the call to finish.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OutboundCallCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The queued call.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Out of credit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/calls/batch": {
      "post": {
        "tags": [
          "Campaigns"
        ],
        "summary": "Create a voice campaign",
        "operationId": "createBatchCampaign",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BatchCampaignCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/calls/batch/{id}/launch": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "post": {
        "tags": [
          "Campaigns"
        ],
        "summary": "Launch a voice campaign",
        "operationId": "launchBatchCampaign",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/campaigns": {
      "get": {
        "tags": [
          "Campaigns"
        ],
        "summary": "List voice campaigns",
        "operationId": "listCampaigns",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/sms": {
      "post": {
        "tags": [
          "SMS"
        ],
        "summary": "Send an SMS",
        "operationId": "sendSms",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SmsSend"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string"
                    },
                    "to": {
                      "type": "string"
                    },
                    "from": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/sms/campaigns": {
      "post": {
        "tags": [
          "SMS"
        ],
        "summary": "Create an SMS campaign",
        "operationId": "createSmsCampaign",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SmsCampaignCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SmsCampaign"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "SMS"
        ],
        "summary": "List SMS campaigns",
        "operationId": "listSmsCampaigns",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "draft",
                "scheduled",
                "running",
                "done",
                "failed"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "campaigns": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/SmsCampaign"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/sms/campaigns/{id}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "tags": [
          "SMS"
        ],
        "summary": "Get an SMS campaign",
        "operationId": "getSmsCampaign",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Includes per-recipient delivery status.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SmsCampaign"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "SMS"
        ],
        "summary": "Update an SMS campaign",
        "operationId": "updateSmsCampaign",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SmsCampaign"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "SMS"
        ],
        "summary": "Cancel an SMS campaign",
        "operationId": "deleteSmsCampaign",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Cancels pending recipients. Already-sent messages cannot be recalled.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "campaign_id": {
                      "type": "string"
                    },
                    "deleted": {
                      "type": "boolean"
                    },
                    "cancelled_count": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/sms/campaigns/{id}/launch": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "post": {
        "tags": [
          "SMS"
        ],
        "summary": "Launch an SMS campaign",
        "operationId": "launchSmsCampaign",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/phone-numbers": {
      "post": {
        "tags": [
          "Phone numbers"
        ],
        "summary": "Import a phone number",
        "operationId": "importPhoneNumber",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PhoneNumberImport"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "phone_number": {
                      "$ref": "#/components/schemas/PhoneNumber"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Phone numbers"
        ],
        "summary": "List phone numbers",
        "operationId": "listPhoneNumbers",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "agent_id",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "phone_numbers": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PhoneNumber"
                      }
                    },
                    "count": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/phone-numbers/{phoneNumber}": {
      "parameters": [
        {
          "name": "phoneNumber",
          "in": "path",
          "required": true,
          "description": "The number in E.164 format. URL-encode the leading + as %2B.",
          "schema": {
            "type": "string",
            "example": "+447446466847"
          }
        }
      ],
      "patch": {
        "tags": [
          "Phone numbers"
        ],
        "summary": "Update a phone number",
        "operationId": "updatePhoneNumber",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PhoneNumberUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "phone_number": {
                      "$ref": "#/components/schemas/PhoneNumber"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Phone numbers"
        ],
        "summary": "Delete a phone number",
        "operationId": "deletePhoneNumber",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Disconnects the number from Nixflex. Does NOT release it from your carrier - carrier billing continues until you release it yourself.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "phone_number": {
                      "type": "object",
                      "properties": {
                        "phone_number": {
                          "type": "string"
                        },
                        "deleted": {
                          "type": "boolean"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/keys": {
      "post": {
        "tags": [
          "Account"
        ],
        "summary": "Create an API key",
        "operationId": "createKey",
        "security": [],
        "description": "Unauthenticated signup endpoint, rate-limited to 3 requests per hour per IP. Most developers use the dashboard instead.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "email": {
                    "type": "string",
                    "format": "email"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KeyResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many key creations from this IP.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/keys/rotate": {
      "post": {
        "tags": [
          "Account"
        ],
        "summary": "Rotate the API secret",
        "operationId": "rotateKey",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "key_id stays the same; only the secret changes. The old secret stops working the instant this returns, and the new one is shown once.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KeyResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/account/llm": {
      "put": {
        "tags": [
          "Account"
        ],
        "summary": "Connect your own LLM",
        "operationId": "setAccountLlm",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Connect an OpenAI-compatible model endpoint. Every conversation turn on your account is then answered by your model, and calls it serves bill at a $0.015/min discount. Verified before saving with a real completion AND a tool-calling round trip - models without OpenAI-style tool calling are refused. The key is stored encrypted and is write-only. If your model fails on a call, the standard stack takes over, the call gets a PROVIDER_FALLBACK event, and that call bills at the standard rate.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "endpoint",
                  "model",
                  "api_key"
                ],
                "properties": {
                  "endpoint": {
                    "type": "string",
                    "description": "OpenAI-compatible https:// base URL, e.g. https://api.openai.com/v1"
                  },
                  "model": {
                    "type": "string",
                    "description": "Model name as your provider knows it"
                  },
                  "api_key": {
                    "type": "string",
                    "description": "Your provider API key. Write-only - never returned"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Verified and saved",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "byo_llm_enabled": {
                      "type": "boolean"
                    },
                    "endpoint": {
                      "type": "string"
                    },
                    "model": {
                      "type": "string"
                    },
                    "verified": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request, or the model failed the connection test (including missing tool-calling support).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "Get your LLM configuration",
        "operationId": "getAccountLlm",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Returns the current configuration. The provider API key is never included.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "byo_llm_enabled": {
                      "type": "boolean"
                    },
                    "endpoint": {
                      "type": "string",
                      "nullable": true
                    },
                    "model": {
                      "type": "string",
                      "nullable": true
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Account"
        ],
        "summary": "Disconnect your own LLM",
        "operationId": "deleteAccountLlm",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Disables and clears the configuration. Calls return to the standard stack and rate from the next call.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "byo_llm_enabled": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/account/tts": {
      "put": {
        "tags": [
          "Account"
        ],
        "summary": "Connect your own TTS",
        "operationId": "setAccountTts",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Connect your own voice provider (elevenlabs or cartesia). The agent then speaks with your voice on every phone call, and calls it serves bill at a $0.02/min discount. Verified before saving with one real synthesis against your account and the exact voice ID. Web calls keep the standard voice. The key is stored encrypted and is write-only. If your voice fails on a call, the standard voice takes over, the call gets a PROVIDER_FALLBACK event, and that call bills at the standard TTS rate.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "provider",
                  "voice_id",
                  "api_key"
                ],
                "properties": {
                  "provider": {
                    "type": "string",
                    "enum": [
                      "elevenlabs",
                      "cartesia"
                    ],
                    "description": "Your voice provider"
                  },
                  "voice_id": {
                    "type": "string",
                    "description": "Voice ID exactly as shown in your provider console"
                  },
                  "api_key": {
                    "type": "string",
                    "description": "Your provider API key. Write-only - never returned"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Verified and saved",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "byo_tts_enabled": {
                      "type": "boolean"
                    },
                    "provider": {
                      "type": "string"
                    },
                    "voice_id": {
                      "type": "string"
                    },
                    "verified": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request, unsupported provider, or the voice failed the connection test.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "Get your TTS configuration",
        "operationId": "getAccountTts",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Returns the current configuration. The provider API key is never included.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "byo_tts_enabled": {
                      "type": "boolean"
                    },
                    "provider": {
                      "type": "string",
                      "nullable": true
                    },
                    "voice_id": {
                      "type": "string",
                      "nullable": true
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Account"
        ],
        "summary": "Disconnect your own TTS",
        "operationId": "deleteAccountTts",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Disables and clears the configuration. Calls return to the standard voice and rate from the next call.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "byo_tts_enabled": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/account/storage": {
      "put": {
        "tags": [
          "Account"
        ],
        "summary": "Connect your own storage",
        "operationId": "setAccountStorage",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Connect an S3-compatible bucket you own. Call recordings are then uploaded to your bucket and Nixflex keeps no copy. The connection is verified with a probe write before saving - broken credentials are rejected, never stored. The secret is stored encrypted and is write-only.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "bucket",
                  "access_key",
                  "secret_key"
                ],
                "properties": {
                  "bucket": {
                    "type": "string",
                    "description": "The exact bucket name at your provider"
                  },
                  "access_key": {
                    "type": "string",
                    "description": "Access key ID with permission to write objects"
                  },
                  "secret_key": {
                    "type": "string",
                    "description": "Secret access key. Write-only - never returned by the API"
                  },
                  "endpoint": {
                    "type": "string",
                    "description": "https:// endpoint of your provider. Leave empty for Amazon S3"
                  },
                  "region": {
                    "type": "string",
                    "description": "Your bucket's region. Defaults to auto"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Verified and saved",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "storage_enabled": {
                      "type": "boolean"
                    },
                    "bucket": {
                      "type": "string"
                    },
                    "endpoint": {
                      "type": "string",
                      "nullable": true
                    },
                    "region": {
                      "type": "string"
                    },
                    "verified": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request, or the probe write to your bucket failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "Get your storage configuration",
        "operationId": "getAccountStorage",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Returns the current storage configuration. The secret access key is never included.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "storage_enabled": {
                      "type": "boolean"
                    },
                    "endpoint": {
                      "type": "string",
                      "nullable": true
                    },
                    "region": {
                      "type": "string",
                      "nullable": true
                    },
                    "bucket": {
                      "type": "string",
                      "nullable": true
                    },
                    "access_key": {
                      "type": "string",
                      "nullable": true
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Account"
        ],
        "summary": "Disconnect your own storage",
        "operationId": "deleteAccountStorage",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Disables and clears the storage configuration. Recordings return to Nixflex EU storage from the next call. Files already in your bucket are untouched - they are yours.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "storage_enabled": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/account/delete": {
      "post": {
        "tags": [
          "Account"
        ],
        "summary": "Delete your account",
        "operationId": "deleteAccount",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Purges your calls, recordings, and messages, then removes your login. Billing records are retained as required by tax law. Irreversible.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/usage": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "Get usage and limits",
        "operationId": "getUsage",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Usage"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/integrations/webhook/number/{phoneNumber}": {
      "parameters": [
        {
          "name": "phoneNumber",
          "in": "path",
          "required": true,
          "description": "The number in E.164 format. URL-encode the leading + as %2B.",
          "schema": {
            "type": "string",
            "example": "+447446466847"
          }
        }
      ],
      "put": {
        "tags": [
          "Integrations"
        ],
        "summary": "Set post-call webhook",
        "operationId": "setWebhook",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Where post-call events are delivered for this number. Every delivery is signed with X-Nixflex-Signature.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UrlConfig"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Integrations"
        ],
        "summary": "Get post-call webhook",
        "operationId": "getWebhook",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Integrations"
        ],
        "summary": "Remove post-call webhook",
        "operationId": "deleteWebhook",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/integrations/webhook2/number/{phoneNumber}": {
      "parameters": [
        {
          "name": "phoneNumber",
          "in": "path",
          "required": true,
          "description": "The number in E.164 format. URL-encode the leading + as %2B.",
          "schema": {
            "type": "string",
            "example": "+447446466847"
          }
        }
      ],
      "put": {
        "tags": [
          "Integrations"
        ],
        "summary": "Set second post-call webhook",
        "operationId": "setWebhook2",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "An optional second destination receiving the same payload. API-only - there is no dashboard field.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UrlConfig"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Integrations"
        ],
        "summary": "Get second post-call webhook",
        "operationId": "getWebhook2",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Integrations"
        ],
        "summary": "Remove second post-call webhook",
        "operationId": "deleteWebhook2",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/integrations/zapier/number/{phoneNumber}": {
      "parameters": [
        {
          "name": "phoneNumber",
          "in": "path",
          "required": true,
          "description": "The number in E.164 format. URL-encode the leading + as %2B.",
          "schema": {
            "type": "string",
            "example": "+447446466847"
          }
        }
      ],
      "put": {
        "tags": [
          "Integrations"
        ],
        "summary": "Set zapier webhook",
        "operationId": "setZapier",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Sends call data into a Zapier trigger.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UrlConfig"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Integrations"
        ],
        "summary": "Get zapier webhook",
        "operationId": "getZapier",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Integrations"
        ],
        "summary": "Remove zapier webhook",
        "operationId": "deleteZapier",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/integrations/make/number/{phoneNumber}": {
      "parameters": [
        {
          "name": "phoneNumber",
          "in": "path",
          "required": true,
          "description": "The number in E.164 format. URL-encode the leading + as %2B.",
          "schema": {
            "type": "string",
            "example": "+447446466847"
          }
        }
      ],
      "put": {
        "tags": [
          "Integrations"
        ],
        "summary": "Set make webhook",
        "operationId": "setMake",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Sends call data into a Make scenario.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UrlConfig"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Integrations"
        ],
        "summary": "Get make webhook",
        "operationId": "getMake",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Integrations"
        ],
        "summary": "Remove make webhook",
        "operationId": "deleteMake",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/integrations/gohighlevel/number/{phoneNumber}": {
      "parameters": [
        {
          "name": "phoneNumber",
          "in": "path",
          "required": true,
          "description": "The number in E.164 format. URL-encode the leading + as %2B.",
          "schema": {
            "type": "string",
            "example": "+447446466847"
          }
        }
      ],
      "put": {
        "tags": [
          "Integrations"
        ],
        "summary": "Set gohighlevel webhook",
        "operationId": "setGohighlevel",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Sends call data into GoHighLevel.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UrlConfig"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Integrations"
        ],
        "summary": "Get gohighlevel webhook",
        "operationId": "getGohighlevel",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Integrations"
        ],
        "summary": "Remove gohighlevel webhook",
        "operationId": "deleteGohighlevel",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/integrations/slack/number/{phoneNumber}": {
      "parameters": [
        {
          "name": "phoneNumber",
          "in": "path",
          "required": true,
          "description": "The number in E.164 format. URL-encode the leading + as %2B.",
          "schema": {
            "type": "string",
            "example": "+447446466847"
          }
        }
      ],
      "put": {
        "tags": [
          "Integrations"
        ],
        "summary": "Set slack notification",
        "operationId": "setSlack",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Posts call summaries to a Slack webhook URL.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UrlConfig"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Integrations"
        ],
        "summary": "Get slack notification",
        "operationId": "getSlack",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Integrations"
        ],
        "summary": "Remove slack notification",
        "operationId": "deleteSlack",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/integrations/precall/number/{phoneNumber}": {
      "parameters": [
        {
          "name": "phoneNumber",
          "in": "path",
          "required": true,
          "description": "The number in E.164 format. URL-encode the leading + as %2B.",
          "schema": {
            "type": "string",
            "example": "+447446466847"
          }
        }
      ],
      "put": {
        "tags": [
          "Integrations"
        ],
        "summary": "Set pre-call gate",
        "operationId": "setPrecall",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Your endpoint decides whether an inbound call is connected, before it is answered.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UrlConfig"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Integrations"
        ],
        "summary": "Get pre-call gate",
        "operationId": "getPrecall",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Integrations"
        ],
        "summary": "Remove pre-call gate",
        "operationId": "deletePrecall",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/integrations/precall/agent/{agentId}": {
      "parameters": [
        {
          "name": "agentId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "put": {
        "tags": [
          "Integrations"
        ],
        "summary": "Set pre-call gate for an agent",
        "operationId": "setPrecallAgent",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UrlConfig"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Integrations"
        ],
        "summary": "Get pre-call gate for an agent",
        "operationId": "getPrecallAgent",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Integrations"
        ],
        "summary": "Remove pre-call gate for an agent",
        "operationId": "deletePrecallAgent",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/integrations/monitor/number/{phoneNumber}": {
      "parameters": [
        {
          "name": "phoneNumber",
          "in": "path",
          "required": true,
          "description": "The number in E.164 format. URL-encode the leading + as %2B.",
          "schema": {
            "type": "string",
            "example": "+447446466847"
          }
        }
      ],
      "put": {
        "tags": [
          "Integrations"
        ],
        "summary": "Enable or disable Live Monitor",
        "operationId": "setMonitor",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Listening to a call puts that whole call on the $0.09/min rate. Enabling the toggle itself is free.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ToggleConfig"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Integrations"
        ],
        "summary": "Get Live Monitor state",
        "operationId": "getMonitor",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Integrations"
        ],
        "summary": "Reset Live Monitor to default",
        "operationId": "deleteMonitor",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/integrations/web-calls/number/{phoneNumber}": {
      "parameters": [
        {
          "name": "phoneNumber",
          "in": "path",
          "required": true,
          "description": "The number in E.164 format. URL-encode the leading + as %2B.",
          "schema": {
            "type": "string",
            "example": "+447446466847"
          }
        }
      ],
      "put": {
        "tags": [
          "Integrations"
        ],
        "summary": "Enable or disable browser calls",
        "operationId": "setWebCalls",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Calls placed from the browser bill at $0.09/min. Enabling the toggle itself is free; ordinary phone calls stay at $0.08/min.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ToggleConfig"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Integrations"
        ],
        "summary": "Get browser calls state",
        "operationId": "getWebCalls",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Integrations"
        ],
        "summary": "Reset browser calls to default",
        "operationId": "deleteWebCalls",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/integrations/calcom/number/{phoneNumber}": {
      "parameters": [
        {
          "name": "phoneNumber",
          "in": "path",
          "required": true,
          "description": "The number in E.164 format. URL-encode the leading + as %2B.",
          "schema": {
            "type": "string",
            "example": "+447446466847"
          }
        }
      ],
      "put": {
        "tags": [
          "Integrations"
        ],
        "summary": "Connect Cal.com booking",
        "operationId": "setCalcom",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Connects a calendar so the agent can check availability and book during a call. One booking provider per number.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Integrations"
        ],
        "summary": "Get Cal.com configuration",
        "operationId": "getCalcom",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Integrations"
        ],
        "summary": "Disconnect Cal.com",
        "operationId": "deleteCalcom",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/integrations/custom-functions/number/{phoneNumber}": {
      "parameters": [
        {
          "name": "phoneNumber",
          "in": "path",
          "required": true,
          "description": "The number in E.164 format. URL-encode the leading + as %2B.",
          "schema": {
            "type": "string",
            "example": "+447446466847"
          }
        }
      ],
      "post": {
        "tags": [
          "Integrations"
        ],
        "summary": "Create a custom function",
        "operationId": "createCustomFunction",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Lets the agent call your own HTTPS endpoint mid-call. Limit 15 per number.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomFunction"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomFunction"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Integrations"
        ],
        "summary": "List custom functions",
        "operationId": "listCustomFunctions",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/integrations/custom-functions/number/{phoneNumber}/{id}": {
      "parameters": [
        {
          "name": "phoneNumber",
          "in": "path",
          "required": true,
          "description": "The number in E.164 format. URL-encode the leading + as %2B.",
          "schema": {
            "type": "string",
            "example": "+447446466847"
          }
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "patch": {
        "tags": [
          "Integrations"
        ],
        "summary": "Update a custom function",
        "operationId": "updateCustomFunction",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Partial update. timeout_ms is clamped to 1000-45000.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomFunction"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomFunction"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Integrations"
        ],
        "summary": "Delete a custom function",
        "operationId": "deleteCustomFunction",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/phone-numbers/{phoneNumber}/callers/{callerNumber}": {
      "parameters": [
        {
          "name": "phoneNumber",
          "in": "path",
          "required": true,
          "description": "One of your numbers in E.164 format. URL-encode the leading + as %2B.",
          "schema": {
            "type": "string",
            "example": "+447450307843"
          }
        },
        {
          "name": "callerNumber",
          "in": "path",
          "required": true,
          "description": "The caller's number in E.164 format. URL-encode the leading + as %2B.",
          "schema": {
            "type": "string",
            "example": "+447453573770"
          }
        }
      ],
      "get": {
        "tags": [
          "Caller context"
        ],
        "summary": "Get caller context",
        "operationId": "getCallerContext",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "What your agent knows about one caller on one of your numbers - what you set and what the engine learned, in one record.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "caller": {
                      "$ref": "#/components/schemas/CallerContext"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Caller context"
        ],
        "summary": "Set caller context",
        "operationId": "setCallerContext",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Sets the details for one caller on one of your numbers. Creates the record if needed. A field left out keeps its value; send null to remove it. last_call and open_item are engine-only and are rejected.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CallerContextSet"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "caller": {
                      "$ref": "#/components/schemas/CallerContext"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Caller context"
        ],
        "summary": "Delete caller context",
        "operationId": "deleteCallerContext",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Erases the whole record for this caller on this number - both what you set and what the engine learned.",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "phone_number": {
                      "type": "string"
                    },
                    "caller_number": {
                      "type": "string"
                    },
                    "deleted": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/phone-numbers/{phoneNumber}/callers/import": {
      "parameters": [
        {
          "name": "phoneNumber",
          "in": "path",
          "required": true,
          "description": "One of your numbers in E.164 format. URL-encode the leading + as %2B.",
          "schema": {
            "type": "string",
            "example": "+447450307843"
          }
        }
      ],
      "post": {
        "tags": [
          "Caller context"
        ],
        "summary": "Import caller context",
        "operationId": "importCallerContext",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "description": "Loads up to 1,000 caller records onto one of your numbers in one request. Every row is validated before any row is written.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "callers"
                ],
                "properties": {
                  "callers": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 1000,
                    "items": {
                      "allOf": [
                        {
                          "type": "object",
                          "required": [
                            "caller_number"
                          ],
                          "properties": {
                            "caller_number": {
                              "type": "string",
                              "example": "+447453573770"
                            }
                          }
                        },
                        {
                          "$ref": "#/components/schemas/CallerContextSet"
                        }
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "phone_number": {
                      "type": "string"
                    },
                    "imported": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request - missing or malformed parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed - bad or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  }
}
